A local variable in TF is any variable which was created with collections=[tf.GraphKeys.LOCAL_VARIABLES]
. For example:
e = tf.Variable(6, name='var_e', collections=[tf.GraphKeys.LOCAL_VARIABLES])
LOCAL_VARIABLES: the subset of Variable objects that are local to each
machine. Usually used for temporarily variables, like counters. Note:
use tf.contrib.framework.local_variable to add to this collection.
They are usually not saved/restored to checkpoint and used for temporary or intermediate values. For a more detailed answer, take a look here.
A global variable is mostly every other variable initialized by you.
In a new version of TF you should use tf.global_variables_initializer()
, tf.local_variables_initializer()
, because the previous functions were deprecated.