簡體   English   中英

有沒有辦法在模型圖張量流( tf.keras.utils.plot_model() )中顯示激活函數?

[英]Is there a way to show activation function in model plots tensorflow ( tf.keras.utils.plot_model() )?

TensorFlow 中的模型圖顯示了輸入的形狀、dtype 和層名稱。 有什么方法可以顯示激活函數的類型嗎? 如果有其他更好的方法來顯示/繪制神經網絡,請告訴。

tf.keras.utils.plot_model()有一個參數show_layer_activations它為圖中的每一層添加激活函數的名稱:

keras.utils.plot_model(model, show_layer_activations=True)

但是,如果我將show_shapesshow_layer_activations都設置為 true, show_layer_activations出現錯誤:

keras.utils.plot_model(model, show_shapes=True, show_layer_activations=True)

---------------------------------------------------------------------------

InvocationException                       Traceback (most recent call last)

<ipython-input-16-12b331a03265> in <module>()
----> 1 keras.utils.plot_model(model, show_shapes=True, show_layer_activations=True)

2 frames

/usr/local/lib/python3.7/dist-packages/pydot_ng/__init__.py in create(self, prog, format)
   1889             raise InvocationException(
   1890                 'Program terminated with status: %d. stderr follows: %s' % (
-> 1891                     status, stderr_output))
   1892         elif stderr_output:
   1893             print(stderr_output)

InvocationException: Program terminated with status: 1. stderr follows: Error: bad label format conv2d|{Conv2D|relu}\n|{input:|output:}|{{(None, 28, 28, 1)}|{(None, 26, 26, 32)}}
Error: bad label format conv2d_1|{Conv2D|relu}\n|{input:|output:}|{{(None, 13, 13, 32)}|{(None, 11, 11, 64)}}
Error: bad label format conv2d_2|{Conv2D|relu}\n|{input:|output:}|{{(None, 5, 5, 64)}|{(None, 3, 3, 128)}}
Error: bad label format dense|{Dense|softmax}\n|{input:|output:}|{{(None, 1152)}|{(None, 10)}}

所以也許使用層名稱來表示激活函數是更好的方法(目前)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM