code: def _get_tensor_value(tensor_or_eager_tensor: tf.Tensor) -> Any:
      if ops.executing_eagerly_outside_functions():
          return np.asarray(tensor_or_eager_tensor)
      else:
          with tf.compat.v1.Session():
              return tensor_or_eager_tensor.eval()
  
imports: import json
  import os
  from typing import Any, Dict, List, Mapping, Optional
  import numpy
  import tensorflow
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_tools
  from tensorflow_transform.analyzers import sanitized_vocab_filename
  from tensorflow_transform.keras_lib import tf_keras
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import metadata_io
  from tensorflow_transform.tf_metadata import schema_utils
  from tensorflow.python.framework import ops
  from tensorflow.tools.docs import doc_controls
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _get_tensor_value(tensor_or_eager_tensor) and returns: np, tensor_or_eager_tensor