admin管理员组文章数量:1410689
In tensorflow, given a model h = Model(input_layer, output_layer)
for example (its summary looks like below)
Model: "functional_1"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Layer (type) ┃ Output Shape ┃ Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ input_layer (InputLayer) │ (None, 784) │ 0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense (Dense) │ (None, 64) │ 50,240 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_1 (Dense) │ (None, 32) │ 2,080 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_2 (Dense) │ (None, 64) │ 2,112 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_3 (Dense) │ (None, 784) │ 50,960 │
└─────────────────────────────────┴────────────────────────┴───────────────┘
Total params: 105,392 (411.69 KB)
Trainable params: 105,392 (411.69 KB)
Non-trainable params: 0 (0.00 B)
If I want to change the number of neurons of dense_1
from 32
to 16
, is there any easy and handy way to update the new configuration?
I tried h.layers[2].units = 16
, which unfortunately didn't change the model setup at all. I am wondering if there is kind of "assignment" operation to do that.
本文标签:
版权声明:本文标题:python - How to easily modify the number of neurons of a certain layer in a Tensorflow neural network? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744823694a2626932.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论