code: def precompute_gram_matrices(image, final_endpoint="fc8"):
      """Pre-computes the Gram matrices on a given image.
  
      Args:
        image: 4-D tensor. Input (batch of) image(s).
        final_endpoint: str, name of the final layer to compute Gram matrices for.
            Defaults to 'fc8'.
  
      Returns:
        dict mapping layer names to their corresponding Gram matrices.
      """
      with tf.Session() as session:
          end_points = vgg.vgg_16(image, final_endpoint=final_endpoint)
          tf.train.Saver(slim.get_variables("vgg_16")).restore(
              session, vgg.checkpoint_file()
          )
          return dict(
              (key, gram_matrix(value).eval())
              for key, value in end_points.items()
          )
  
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 1 for calling a global function with example usage: precompute_gram_matrices(image, final_endpoint) and returns: dict