code: def test_shaping_utils(self):
      @make_tf_graph([(None, 4, 5)])
      def build_flexible_model(x):
          return tf.nn.relu(x)
  
      model, inputs, outputs = build_flexible_model
      input_name = TFConverter._get_tensor_name(inputs[0])
      output_name = TFConverter._get_tensor_name(outputs[0])
  
      # static-Flexible shape
      mlmodel = converter.convert(
          model,
          inputs=[TensorType(name=input_name)],
          outputs=[output_name],
      )
      assert mlmodel is not None
      input_values = [random_gen((3, 4, 5), -10.0, 10.0)]
      input_dict = {input_name: input_values[0]}
      if _IS_MACOS:
          ret = mlmodel.predict(input_dict)
          np.allclose(
              ret[output_name], np.maximum(input_values[0], 0.0)
          )
  
      # Enumerate shape
      inputs_shape = [
          TensorType(
              input_name,
              EnumeratedShapes(shapes=[(3, 4, 5), (4, 4, 5)]),
          )
      ]
      mlmodel = converter.convert(
          model, inputs=inputs_shape, outputs=[output_name]
      )
      assert mlmodel is not None
      input_values = [random_gen((3, 4, 5), -10.0, 10.0)]
      input_dict = {input_name: input_values[0]}
      if _IS_MACOS:
          ret = mlmodel.predict(input_dict)
          np.allclose(
              ret[output_name], np.maximum(input_values[0], 0.0)
          )
  
      input_values = [random_gen((4, 4, 5), -10.0, 10.0)]
      input_dict = {input_name: input_values[0]}
      if _IS_MACOS:
          ret = mlmodel.predict(input_dict)
          np.allclose(
              ret[output_name], np.maximum(input_values[0], 0.0)
          )
  
      if _IS_MACOS:
          with pytest.raises(RuntimeError) as e:
              input_values = [random_gen((5, 4, 5), -10.0, 10.0)]
              input_dict = {input_name: input_values[0]}
              ret = mlmodel.predict(input_dict)
  
      # Ranged shape
      inputs_shape = [TensorType(input_name, [RangeDim(3, 5), 4, 5])]
      mlmodel = converter.convert(
          model, inputs=inputs_shape, outputs=[output_name]
      )
      assert mlmodel is not None
      input_values = [random_gen((3, 4, 5), -10.0, 10.0)]
      input_dict = {input_name: input_values[0]}
      if _IS_MACOS:
          ret = mlmodel.predict(input_dict)
          np.allclose(
              ret[output_name], np.maximum(input_values[0], 0.0)
          )
  
      input_values = [random_gen((4, 4, 5), -10.0, 10.0)]
      input_dict = {input_name: input_values[0]}
      if _IS_MACOS:
          ret = mlmodel.predict(input_dict)
          np.allclose(
              ret[output_name], np.maximum(input_values[0], 0.0)
          )
  
      if _IS_MACOS:
          with pytest.raises(RuntimeError) as e:
              input_values = [random_gen((2, 4, 5), -10.0, 10.0)]
              input_dict = {input_name: input_values[0]}
              ret = mlmodel.predict(input_dict)
  
imports: import numpy
  import os
  import six
  import pytest
  import shutil
  import tempfile
  import coremltools
  import coremltools.converters
  from coremltools._deps import _IS_MACOS
  import coremltools.proto.FeatureTypes_pb2
  from coremltools import TensorType, ImageType, RangeDim, EnumeratedShapes
  from coremltools.converters.mil.testing_utils import random_gen
  from coremltools.converters.mil.frontend.tensorflow.converter import TFConverter
  from coremltools.converters.mil.frontend.tensorflow.test.testing_utils import frontend, make_tf_graph, run_compare_tf, get_tf_keras_io_names
label_desc: Use image node_id 12 for calling the TestTf1ModelInputsOutputs obj's underlying member method code with example usage: obj.test_shaping_utils() and returns: tf