def create_composite_loss(self,
                            losses,
                            regularize=True,
                            include_marked=True,
                            name='cost'):
    """Creates a loss that is the sum of all specified losses.

    Args:
      losses: A sequence of losses to include.
      regularize: Whether or not to include regularization losses.
      include_marked: Whether or not to use the marked losses.
      name: The name for this variable.
    Returns:
      A single tensor that is the sum of all losses.
    Raises:
      ValueError: if there are no losses.
    """
    all_losses = []
    if losses:
      all_losses.extend(losses)
    if include_marked:
      all_losses.extend(self.marked_losses)
    if not all_losses:
      raise ValueError('No losses specified!')
    if regularize:
      all_losses.extend(self.regularization_losses)
    with self._g.as_default():
      result = tf.add_n(all_losses, name=name)
      self.add_scalar_summary(result)
      return result
Creates a loss that is the sum of all specified losses.

    Args:
      losses: A sequence of losses to include.
      regularize: Whether or not to include regularization losses.
      include_marked: Whether or not to use the marked losses.
      name: The name for this variable.
    Returns:
      A single tensor that is the sum of all losses.
    Raises:
      ValueError: if there are no losses.