(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.
Pre-computes the Gram matrices on a given image.
Pre - computes the Gram matrices on a given image .
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())
def precompute_gram_matrices ( image , final_endpoint = 'fc8' ) : 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 ( ) )