code: def test_tf2keras_enumerated_shapes(backend):
      input_shape = (28, 28, 3)
      # None denotes seq_len dimension
      x = tf.keras.Input(shape=input_shape, name="input")
      C_out = 2
      kHkW = 3
      y = tf.keras.layers.Conv2D(
          C_out, kHkW, activation="relu", input_shape=input_shape
      )(x)
      keras_model = tf.keras.Model(inputs=[x], outputs=[y])
  
      # One RangeDim shared by two inputs
      shapes = [(1, 28, 28, 3), (1, 56, 56, 3)]
      enumerated_shapes = ct.EnumeratedShapes(shapes=shapes)
      tensor_input = ct.TensorType(
          name="input", shape=enumerated_shapes
      )
      mlmodel = ct.convert(
          keras_model, inputs=[tensor_input], convert_to=backend[0]
      )
  
      # Test (1, 28, 28, 3) shape
      test_input_x = np.random.rand(*shapes[0]).astype(np.float32)
      expected_val = keras_model([test_input_x])
      if ct.utils._is_macos():
          results = mlmodel.predict({"input": test_input_x})
          # rdar://101303143 ([CI] test_tf2keras_enumerated_shapes is getting some stochastic numerical issues on intel machines)
          # The tolerance is set a little bit big here. Need to investigate this issue if possible and lower the threshold down.
          np.testing.assert_allclose(
              results["Identity"], expected_val, atol=1e-2, rtol=3
          )
  
          # Test (1, 56, 56, 3) shape (can't verify numerical parity with Keras
          # which doesn't support enumerated shape)
          test_input_x = np.random.rand(*shapes[1]).astype(np.float32)
          results = mlmodel.predict({"input": test_input_x})
  
          # Test with a wrong shape
          with pytest.raises(
              RuntimeError,
              match=r"MultiArray Shape \(1 x 29 x 29 x 3\) was not in enumerated set of allowed shapes",
          ):
              test_input_x = np.random.rand(1, 29, 29, 3).astype(
                  np.float32
              )
              results = mlmodel.predict({"input": test_input_x})
  
imports: import itertools
  import os
  import platform
  from os import chdir, getcwd
  from shutil import rmtree
  from tempfile import mkdtemp
  import numpy
  import pytest
  import coremltools
  from coremltools.converters.mil.frontend.tensorflow.test.test_tf_conversion_api import TestInputOutputConversionAPI
  from coremltools.converters.mil.frontend.tensorflow.test.test_tf_conversion_api import TestiOS16DefaultIODtype
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.testing_reqs import backends
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import layers
label_desc: Use image node_id 5 for calling the TestTF2FlexibleInput obj's underlying member method code with example usage: obj.test_tf2keras_enumerated_shapes(backend) without return types