A local variable in TF is any variable that was created using collections=[tf.GraphKeys.LOCAL_VARIABLES] . For instance:
e = tf.Variable(6, name='var_e', collections=[tf.GraphKeys.LOCAL_VARIABLES])
LOCAL_VARIABLES: a subset of Variable objects that are local to each machine. Commonly used for temporary variables such as counters. Note: use tf.contrib.framework.local_variable to add to this collection.
Usually they are not saved / not restored to the control point and are not used for temporary or intermediate values. For a more detailed answer, see here .
A global variable is basically any other variable that you initialize.
In the new version of TF, you should use tf.global_variables_initializer() , tf.local_variables_initializer() because the previous functions were deprecated.
source share