Keras重置层号 [英] Keras reset layer numbers

查看:71
本文介绍了Keras重置层号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Keras将递增的ID号分配给相同类型的层,例如max_pooling1d_7max_pooling1d_8max_pooling1d_9等我的代码的每次迭代都会构造一个新模型,从model = Sequential()开始,然后通过model.add()添加图层.即使每个循环都创建一个新的顺序对象,图层ID编号仍会从上一个循环开始继续递增.由于我的流程长期运行,因此这些ID号可能会变得非常大.我担心这可能会引起一些问题.为什么model = Sequential()无法重置ID?有没有办法重置它们?在每个周期之后,我不再使用层ID号,可以将其丢弃,但是如何?我正在使用Tensorflow后端.

Keras assigns incrementing ID numbers to layers of the same type, e.g. max_pooling1d_7, max_pooling1d_8, max_pooling1d_9,etc. Each iteration of my code constructs a new model, starting with model = Sequential() and then adding layers via model.add(). Even though each cycle creates a new Sequential object, the layer ID numbers continue incrementing from the previous cycle. Since my process is long-running these ID numbers can grow very large. I am concerned that this could cause some problem. Why are the IDs not reset by model = Sequential()? Is there a way to reset them? After each cycle I have no use for the layer ID numbers and can discard them, but how? I am using the Tensorflow backend.

推荐答案

该解决方案,来自 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆