code: def testEncodeDecodeTensorNode(self):
      g = tf.Graph()
      with g.as_default():
          example = tf.compat.v1.placeholder(tf.string, name="example")
          features = tf.io.parse_example(
              serialized=example,
              features={
                  "age": tf.io.FixedLenFeature(
                      [], dtype=tf.int64, default_value=-1
                  ),
                  "gender": tf.io.FixedLenFeature([], dtype=tf.string),
                  "varstr": tf.io.VarLenFeature(tf.string),
                  "varint": tf.io.VarLenFeature(tf.int64),
                  "varfloat": tf.io.VarLenFeature(tf.float32),
                  "unicode\u1234": tf.io.FixedLenFeature(
                      [], dtype=tf.string
                  ),
              },
          )
          constant = tf.constant(1.0)
          sparse = tf.SparseTensor(
              indices=tf.compat.v1.placeholder(tf.int64),
              values=tf.compat.v1.placeholder(tf.int64),
              dense_shape=tf.compat.v1.placeholder(tf.int64),
          )
  
          test_cases = [
              example,
              features["age"],
              features["gender"],
              features["varstr"],
              features["varint"],
              features["varfloat"],
              features["unicode\u1234"],
              constant,
              sparse,
          ]
          for tensor in test_cases:
              got_tensor = encoding.decode_tensor_node(
                  g, encoding.encode_tensor_node(tensor)
              )
              if isinstance(tensor, tf.SparseTensor):
                  self.assertEqual(tensor.indices, got_tensor.indices)
                  self.assertEqual(tensor.values, got_tensor.values)
                  self.assertEqual(
                      tensor.dense_shape, got_tensor.dense_shape
                  )
              else:
                  self.assertEqual(tensor, got_tensor)
  
imports: import tensorflow
  from tensorflow_model_analysis.eval_saved_model import encoding
label_desc: Use image node_id 3 for calling the EncodingTest obj's underlying member method code with example usage: obj.testEncodeDecodeTensorNode() without return types