@scopes.add_arg_scope
def variable(name, shape=None, dtype=tf.float32, initializer=None, regularizer=None, trainable=True, collections=None, device='', restore=True):
 collections = list((collections or []))
 collections += [tf.GraphKeys.GLOBAL_VARIABLES, MODEL_VARIABLES]
 if restore:
  collections.append(VARIABLES_TO_RESTORE)
 collections = set(collections)
 with tf.device(variable_device(device, name)):
  return tf.get_variable(name, shape=shape, dtype=dtype, initializer=initializer, regularizer=regularizer, trainable=trainable, collections=collections)

@ scopes . add_arg_scope def variable ( name , shape = None , dtype = tf . float32 , initializer = None , regularizer = None , trainable = True , collections = None , device = '' , restore = True ) : collections = list ( ( collections or [ ] ) ) collections += [ tf . GraphKeys . GLOBAL_VARIABLES , MODEL_VARIABLES ] if restore : collections . append ( VARIABLES_TO_RESTORE ) collections = set ( collections ) with tf . device ( variable_device ( device , name ) ) : return tf . get_variable ( name , shape = shape , dtype = dtype , initializer = initializer , regularizer = regularizer , trainable = trainable , collections = collections )
gets an existing variable with these parameters or creates a new one .