Python Forum

Full Version: Read Tensorflow Documentation - Clarification
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am currently trying to work with tensorflow and keras and I have been following some tutorials while using the online documentation as well. (https://www.tensorflow.org/api_docs/python/tf/keras)
I have sort of written a walkthrough on how do I understand the dosumentation and I owuld like a feedback on my way of thinking please.


Here is one example of the ode:
model =  Sequential()
model.add(Conv2D(64, (3,3), input_shape = X.shape[1:]))
For this part of example, all the required modules are imported in the beginning:

import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D
I try to figure out how the above command is valid using the documentation.

As it shows, for keras, the only Classes are Sequential and Model and the rest are Modules.
Once you click on Sequential, it seems that it inherits everything (attributes and methods) from Method, Layer and Module as well as having some of its own methods as well.

We can see that
add
is one of its own methods and takes as input a layer instance. It is fair to assume that it refers to the layers module shown in the overview (link above)

In this case, an instance of the class Conv2D is created and that's all, right?


Questions

So, as far as I understand, the Modules in th overview, are Modules that are used for some of the Classes, they cannot be used in general and everywhere, right?

To import the Sequential class, I could have used
tf.keras.Sequential
instead, right?

Thank you in advance!