def _get_variables(func):
 variables = []
 constants = []
 def custom_getter(getter, name, **kwargs):
  trainable = kwargs['trainable']
  kwargs['trainable'] = False
  variable = getter(name, **kwargs)
  if trainable:
   variables.append(variable)
  else:
   constants.append(variable)
  return variable
 with tf.name_scope('unused_graph'):
  _wrap_variable_creation(func, custom_getter)
 return (variables, constants)

def _get_variables ( func ) : variables = [ ] constants = [ ] def custom_getter ( getter , name , ** kwargs ) : trainable = kwargs [ 'trainable' ] kwargs [ 'trainable' ] = False variable = getter ( name , ** kwargs ) if trainable : variables . append ( variable ) else : constants . append ( variable ) return variable with tf . name_scope ( 'unused_graph' ) : _wrap_variable_creation ( func , custom_getter ) return ( variables , constants )
calls func .