Variables

Variables are the containers used to store values. Variables will be used as input to several other operations in the computational graph. We can create TensorFlow variables using the tf.Variable() function. In the following example, we define a variable with values from a random normal distribution and name it weights:

weights = tf.Variable(tf.random_normal([3, 2], stddev=0.1), name="weights")

However, after defining a variable, we need to explicitly create an initialization operation using the tf.global_variables_initializer() method which will allocate resources for the variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.41.235