上QQ阅读APP看书,第一时间看更新
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.