Better navigating TF documentation


I am sometimes a little confused with how to navigate TF documentation.

In W2 Assigninment 2 Exercise 2 we play with mobilenet model and set the trainable attribute to be false:

base_model.trainable = False

Where can I find that the trainable attribute even exists? When I look at TF documentation for tf.keras.model it doesn’t show any such attribute.

Thanks for your lights

Please check tf.keras.layers.Layer.

Thanks @saifkhanengr

Im slightly confused though: Aren’t we setting the trainable parameter on an object of class Model in base_model.trainable ?


TensorFlow layers are all objects. They inherit methods and parameters from their parent class.

Sometimes you have to go quite some distance up the parent tree to find the basis.

Here’s a thread which discusses how the trainable attributes work in some detail.

This is also a case in which it’s worth spending some time on the higher level TF documentation, which includes some very nice tutorials. E.g. here’s a thread with links to some such tutorials including one written by Francis Chollet (the original author of Keras) that is essentially a chapter from his book on Keras.