def _make_with_custom_variables(func, variables):
 variables = collections.deque(variables)
 def custom_getter(getter, name, **kwargs):
  if kwargs['trainable']:
   return variables.popleft()
  else:
   kwargs['reuse'] = True
   return getter(name, **kwargs)
 return _wrap_variable_creation(func, custom_getter)

def _make_with_custom_variables ( func , variables ) : variables = collections . deque ( variables ) def custom_getter ( getter , name , ** kwargs ) : if kwargs [ 'trainable' ] : return variables . popleft ( ) else : kwargs [ 'reuse' ] = True return getter ( name , ** kwargs ) return _wrap_variable_creation ( func , custom_getter )
calls func and replaces any trainable variables .