Tensorflow 图显示了所有被调用的计算。你将无法简化它。
作为替代方案,Keras 有自己的逐层图。这显示了您网络的清晰简洁的结构。您可以通过调用生成它
from keras.utils import plot_model
plot_model(model, to_file='/some/pathname/model.png')
最后,您还可以调用model.summary(),它会生成图表的文本版本,并带有额外的摘要。
这是model.summary() 的输出,例如:
Layer (type) Output Shape Param # Connected to
====================================================================================================
input_1 (InputLayer) (None, 2048) 0
____________________________________________________________________________________________________
activation_1 (Activation) (None, 2048) 0
____________________________________________________________________________________________________
dense_1 (Dense) (None, 511) 1047039
____________________________________________________________________________________________________
activation_2 (Activation) (None, 511) 0
____________________________________________________________________________________________________
decoder_layer_1 (DecoderLayer) (None, 512) 0
____________________________________________________________________________________________________
ctg_output (OrLayer) (None, 201) 102912
____________________________________________________________________________________________________
att_output (OrLayer) (None, 312) 159744
====================================================================================================
Total params: 1,309,695.0
Trainable params: 1,309,695.0
Non-trainable params: 0.0