Home > other >  What is the difference between the .trainable and training parameters in Tensorflow
What is the difference between the .trainable and training parameters in Tensorflow

Time:05-12

What is the difference between model.trainable=False and model(..,training=False)? In general, when is one used over the other and when are they both used together in a model?

CodePudding user response:

trainable is property of a tensor and indicates whether this tensor can be updated by your optimizer during training.

training is a flag to notify the layer/model being called that the forward call is made during training. It is necessary because some layers behave differently during training and inferencing, and this flag is used for some switching logic within their __call__() method. A notable example is Sample

  • Related