code: def test_parse_tensor(self):
      # Zero-rank tensor
      attr = attr_value.AttrValue()
      attr.tensor.version_number = 1
      attr.tensor.dtype = types.DataType.DT_INT32
      t = parse.parse_attr(attr)
      self.assertTrue(isinstance(t, mil_types.int32))
      self.assertEqual(0, t.val)
  
      # Non-zero rank
      attr = attr_value.AttrValue()
      attr.tensor.version_number = 1
      attr.tensor.dtype = types.DataType.DT_INT32
      shaped_attr = self._attr_with_shape(
          [(1, "outer"), (2, "middle"), (3, "inner")]
      )
      attr.tensor.tensor_shape.dim.extend(shaped_attr.shape.dim)
      attr.tensor.int_val.extend([55, 56, 57])
  
      t = parse.parse_attr(attr)
      self.assertEqual([55, 56, 57], t.val.tolist())
      self.assertEqual("tensor", mil_types.get_type_info(t).name)
  
      # Note that the result of t.get_primitive() is a function that returns a type
      # rather than an instance of that type as it is when the tensor has rank zero.
      self.assertTrue(isinstance(t.get_primitive()(), mil_types.int32))
      self.assertEqual((1, 2, 3), t.get_shape())
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/tensorflow/test/test_parse.py
imports: import unittest
  import pytest
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import tensor_shape_pb2
  from tensorflow.core.framework import types_pb2
  from coremltools.converters.mil.mil import types
  import coremltools.converters.mil.frontend.tensorflow.parse
label_desc: Use image node_id 5 for calling the TestParse obj's underlying member method code with example usage: obj.test_parse_tensor() without return types