Number of trainable parameters is zero when using vars(self)


when I’m defining the my model block using dynamic variables names, for some reason the weight are not being trained. Also, the dense layer does not appear in the summary. What I am missing? Why are the weights not being trained?

The code is in the images below.

Hi Rgivisiez, good try!

I also try it with C1_W4_Lab_1_basic-model and get some feedbacks for you reference:

" ValueError: This model has not yet been built. Build the model first by calling build() or calling fit() with some data, or specify an input_shape argument in the first layer(s) for automatic build."

I recreated the same script as you and had the same output. Then I considered removing the activations so it could default using a linear regression and still had the same outcome. At this point I am tempted to think the model is so simple to learn anything. Perhaps you could consider adding more layers

I thought that using would be enough to build the model. Anyway, I modified the class as in the image below and it worked.