code: def total_loss(
      inputs,
      stylized_inputs,
      style_gram_matrices,
      content_weights,
      style_weights,
      reuse=False,
  ):
      """Computes the total loss function.
  
      The total loss function is composed of a content, a style and a total
      variation term.
  
      Args:
        inputs: Tensor. The input images.
        stylized_inputs: Tensor. The stylized input images.
        style_gram_matrices: dict mapping layer names to their corresponding
            Gram matrices.
        content_weights: dict mapping layer names to their associated content loss
            weight. Keys that are missing from the dict won't have their content
            loss computed.
        style_weights: dict mapping layer names to their associated style loss
            weight. Keys that are missing from the dict won't have their style
            loss computed.
        reuse: bool. Whether to reuse model parameters. Defaults to False.
  
      Returns:
        Tensor for the total loss, dict mapping loss names to losses.
      """
      # Propagate the input and its stylized version through VGG16.
      end_points = vgg.vgg_16(inputs, reuse=reuse)
      stylized_end_points = vgg.vgg_16(stylized_inputs, reuse=True)
  
      # Compute the content loss
      total_content_loss, content_loss_dict = content_loss(
          end_points, stylized_end_points, content_weights
      )
  
      # Compute the style loss
      total_style_loss, style_loss_dict = style_loss(
          style_gram_matrices, stylized_end_points, style_weights
      )
  
      # Compute the total loss
      loss = total_content_loss + total_style_loss
  
      loss_dict = {"total_loss": loss}
      loss_dict.update(content_loss_dict)
      loss_dict.update(style_loss_dict)
  
      return loss, loss_dict
  
file_path: magenta/magenta/models/image_stylization/learning.py
imports: from magenta.models.image_stylization import vgg
  import numpy
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 2 for calling a global function with example usage: total_loss(inputs, stylized_inputs, style_gram_matrices, content_weights, style_weights, reuse) and returns: loss,  loss_dict