code: def encode_tensor_node(node: types.TensorType) -> any_pb2.Any:
      """Encode a "reference" to a Tensor/SparseTensor as a TensorInfo in an Any.
  
      We put the Tensor / SparseTensor in a TensorInfo, which we then wrap in an
      Any so that it can be added to the CollectionDef.
  
      Args:
        node: Tensor node.
  
      Returns:
        Any proto wrapping a TensorInfo.
      """
      any_buf = any_pb2.Any()
      tensor_info = tf.compat.v1.saved_model.utils.build_tensor_info(
          node
      )
      any_buf.Pack(tensor_info)
      return any_buf
  
file_path: model-analysis/tensorflow_model_analysis/eval_saved_model/encoding.py
imports: import tensorflow
  from tensorflow_model_analysis.api import types
  from google.protobuf import any_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: encode_tensor_node(node) and returns: any_buf