def _gather_clone_loss(clone, num_clones, regularization_losses):
 sum_loss = None
 clone_loss = None
 regularization_loss = None
 with tf.device(clone.device):
  all_losses = []
  clone_losses = tf.get_collection(tf.GraphKeys.LOSSES, clone.scope)
  if clone_losses:
   clone_loss = tf.add_n(clone_losses, name='clone_loss')
   if (num_clones > 1):
    clone_loss = tf.div(clone_loss, (1.0 * num_clones), name='scaled_clone_loss')
   all_losses.append(clone_loss)
  if regularization_losses:
   regularization_loss = tf.add_n(regularization_losses, name='regularization_loss')
   all_losses.append(regularization_loss)
  if all_losses:
   sum_loss = tf.add_n(all_losses)
 if (clone_loss is not None):
  tf.scalar_summary((clone.scope + '/clone_loss'), clone_loss, name='clone_loss')
 if (regularization_loss is not None):
  tf.scalar_summary('regularization_loss', regularization_loss, name='regularization_loss')
 return sum_loss

def _gather_clone_loss ( clone , num_clones , regularization_losses ) : sum_loss = None clone_loss = None regularization_loss = None with tf . device ( clone . device ) : all_losses = [ ] clone_losses = tf . get_collection ( tf . GraphKeys . LOSSES , clone . scope ) if clone_losses : clone_loss = tf . add_n ( clone_losses , name = 'clone_loss' ) if ( num_clones > 1 ) : clone_loss = tf . div ( clone_loss , ( 1.0 * num_clones ) , name = 'scaled_clone_loss' ) all_losses . append ( clone_loss ) if regularization_losses : regularization_loss = tf . add_n ( regularization_losses , name = 'regularization_loss' ) all_losses . append ( regularization_loss ) if all_losses : sum_loss = tf . add_n ( all_losses ) if ( clone_loss is not None ) : tf . scalar_summary ( ( clone . scope + '/clone_loss' ) , clone_loss , name = 'clone_loss' ) if ( regularization_loss is not None ) : tf . scalar_summary ( 'regularization_loss' , regularization_loss , name = 'regularization_loss' ) return sum_loss
gather the loss for a single clone .