code: def _value_to_tensor(value):
      if isinstance(value, tf.compat.v1.SparseTensorValue):
          return tf.compat.v1.convert_to_tensor_or_sparse_tensor(value)
      elif isinstance(value, tf.compat.v1.ragged.RaggedTensorValue):
          return tf.ragged.constant(value.to_list())
      else:
          return tf.constant(value)
  
imports: import os
  import numpy
  from packaging import version
  import tensorflow
  from tensorflow_transform import analyzers
  from tensorflow_transform import annotators
  from tensorflow_transform import tf_utils
  from tensorflow_transform import test_case
  from tensorflow.python.framework import composite_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: _value_to_tensor(value) and returns: tf, tf, tf