def create_clones(config, model_fn, args=None, kwargs=None):
 clones = []
 args = (args or [])
 kwargs = (kwargs or {})
 with slim.arg_scope([slim.model_variable, slim.variable], device=config.variables_device()):
  for i in range(0, config.num_clones):
   with tf.name_scope(config.clone_scope(i)) as clone_scope:
    clone_device = config.clone_device(i)
    with tf.device(clone_device):
     with tf.variable_scope(tf.get_variable_scope(), reuse=(True if (i > 0) else None)):
      outputs = model_fn(*args, **kwargs)
     clones.append(Clone(outputs, clone_scope, clone_device))
 return clones

def create_clones ( config , model_fn , args = None , kwargs = None ) : clones = [ ] args = ( args or [ ] ) kwargs = ( kwargs or { } ) with slim . arg_scope ( [ slim . model_variable , slim . variable ] , device = config . variables_device ( ) ) : for i in range ( 0 , config . num_clones ) : with tf . name_scope ( config . clone_scope ( i ) ) as clone_scope : clone_device = config . clone_device ( i ) with tf . device ( clone_device ) : with tf . variable_scope ( tf . get_variable_scope ( ) , reuse = ( True if ( i > 0 ) else None ) ) : outputs = model_fn ( * args , ** kwargs ) clones . append ( Clone ( outputs , clone_scope , clone_device ) ) return clones
creates multiple clones according to config using a model_fn .