Why does get_weights return an empty list?

后端 未结 2 1194
半阙折子戏
半阙折子戏 2021-02-15 14:15

I am teaching myself data science and something peculiar has caught my eyes. In a sample DNN tutorial I was working on, I found that the Keras layer.get_weights() f

2条回答
  •  情深已故
    2021-02-15 15:01

    Maybe you are asking for weights before they are created.

    Weights are created when the Model is first called on inputs or build() is called with an input_shape.

    For example, if you load weights from checkpoint but you don't give an input_shape to the model, then get_weights() will return an empty list.

提交回复
热议问题