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()
function returned empty list for my variables. I've successfully cross validated and used model.fit()
function to compute the recall scores.
But as I'm trying to use the get_weights()
function on my categorical variables, it returns empty weights for all.
I'm not looking for a solution to code but I am just curious about what would possibly cause this. I've read through the Keras API but it did not provide me with the information I was hoping to see. What could cause the get_weights()
function in Keras to return empty list except for of course the weights not being set?
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 aninput_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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With