Giorgio Arlandi
Giorgio Arlandi

Reputation: 23

Are weights and trainable variables the same in Keras?

That's all, I need to know if they are the same or correspond to different concepts.

When I use the model.summary() method, it gives me the amount of trainable variables, I need to know if they are the same as the weights

Upvotes: 2

Views: 1037

Answers (1)

Daniel Möller
Daniel Möller

Reputation: 86600

"Almost".

In most cases, yes, they are. But there are layers that use non-trainable weights for other purposes.

For instance, a BatchNormalization layers has four weight variables:

  • mean: not trainable with backpropagation, but learnable from taking statistics from the data
  • variance: not trainable with backpropagation, but learnable from taking statistics from the data
  • scale: trainable with backpropagation
  • offset: trainable with backpropagation

Upvotes: 3

Related Questions