def METHOD_NAME(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