code: def _compute_gram_matrix(feature: tf.Tensor) -> tf.Tensor:
      """Computes gram matrix for the feature map.
  
      Args:
        feature: [B, H, W, C] feature map.
  
      Returns:
        [B, C, C] gram matrix.
      """
      h, w, c = feature.shape[1:].as_list()
      feat_reshaped = tf.reshape(feature, shape=(-1, h * w, c))
      feat_gram = tf.matmul(
          tf.transpose(feat_reshaped, perm=[0, 2, 1]), feat_reshaped
      )
      return feat_gram / (c * h * w)
  
imports: import abc
  from typing import Mapping, Sequence
  import dataclasses
  from typing import Any, Optional
  import numpy
  import tensorflow
  from mediapipe.model_maker.python.core.utils import file_util
  from mediapipe.model_maker.python.core.utils import model_util
  from official.modeling import tf_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _compute_gram_matrix(feature) and returns: unknown