def _make_nets(variables, config, net_assignments):
 name_to_index = dict(((v.name.split(':')[0], i) for (i, v) in enumerate(variables)))
 if (net_assignments is None):
  if (len(config) != 1):
   raise ValueError('Default net_assignments can only be used if there is a single net config.')
  with tf.variable_scope('vars_optimizer'):
   (key, kwargs) = config.items()[0]
   net = networks.factory(**kwargs)
  nets = {key: net}
  keys = [key]
  subsets = [range(len(variables))]
 else:
  nets = {}
  keys = []
  subsets = []
  with tf.variable_scope('vars_optimizer'):
   for (key, names) in net_assignments:
    if (key in nets):
     raise ValueError('Repeated netid in net_assigments.')
    nets[key] = networks.factory(**config[key])
    subset = [name_to_index[name] for name in names]
    keys.append(key)
    subsets.append(subset)
    print('Net: {}, Subset: {}'.format(key, subset))
 return (nets, keys, subsets)

def _make_nets ( variables , config , net_assignments ) : name_to_index = dict ( ( ( v . name . split ( ':' ) [ 0 ] , i ) for ( i , v ) in enumerate ( variables ) ) ) if ( net_assignments is None ) : if ( len ( config ) != 1 ) : raise ValueError ( 'Default net_assignments can only be used if there is a single net config.' ) with tf . variable_scope ( 'vars_optimizer' ) : ( key , kwargs ) = config . items ( ) [ 0 ] net = networks . factory ( ** kwargs ) nets = { key : net } keys = [ key ] subsets = [ range ( len ( variables ) ) ] else : nets = { } keys = [ ] subsets = [ ] with tf . variable_scope ( 'vars_optimizer' ) : for ( key , names ) in net_assignments : if ( key in nets ) : raise ValueError ( 'Repeated netid in net_assigments.' ) nets [ key ] = networks . factory ( ** config [ key ] ) subset = [ name_to_index [ name ] for name in names ] keys . append ( key ) subsets . append ( subset ) print ( 'Net: {}, Subset: {}' . format ( key , subset ) ) return ( nets , keys , subsets )
creates the optimizer networks .