I am reviewing the code in this example: fully_connected_reader.py
I am confused with Line 147 and 148:
init_op = tf.group(tf.initialize_all_variables(),
tf.initialize_local_variables())
I don't know which variables are all variables
and which are local variables
. Any ideas?
global_variables_initializer() in a session will your variables hold the values you told them to hold when you declare them ( tf. Variable(tf. zeros(...)) , tf.
New!
To initialize a new variable from the value of another variable use the other variable's initialized_value() property. You can use the initialized value directly as the initial value for the new variable, or you can use it as any other tensor to compute a value for the new variable.
First, remember that you can use the TensorFlow eye functionality to easily create a square identity matrix. We create a 5x5 identity matrix with a data type of float32 and assign it to the Python variable identity matrix. So we used tf. eye, give it a size of 5, and the data type is float32.
tf.initialize_all_variables()
is a shortcut to tf.initialize_variables(tf.all_variables())
, tf.initialize_local_variables()
is a shortcut to tf.initialize_variables(tf.local_variables())
, which initializes variables in GraphKeys.VARIABLES
and GraphKeys.LOCAL_VARIABLE
collections, respectively.
Variables in GraphKeys.LOCAL_VARIABLES
collection are variables that are added to the graph, but not saved or restored (source).
tf.Variable()
by default adds a new variable to GraphKeys.VARIABLE
collection, which can be controlled by collections= argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With