code: def test_tf2keras_outofbound_range_dim(use_symbol, backend):
      input_dim = 3
      # None denotes seq_len dimension
      x = tf.keras.Input(shape=(None, input_dim), name="seq")
      y = x * 2
      keras_model = tf.keras.Model(inputs=[x], outputs=[y])
  
      if use_symbol:
          seq_len_dim = ct.RangeDim(
              symbol="sequence_len", lower_bound=3, upper_bound=5
          )
      else:
          seq_len_dim = ct.RangeDim(lower_bound=3, upper_bound=5)
      seq_input = ct.TensorType(
          name="seq", shape=(1, seq_len_dim, input_dim)
      )
      mlmodel = ct.convert(
          keras_model, inputs=[seq_input], convert_to=backend[0]
      )
  
      # seq_len is within bound
      batch = 1
      seq_len = 3
      test_input_x = np.random.rand(batch, seq_len, input_dim).astype(
          np.float32
      )
      expected_val = keras_model([test_input_x])
      if ct.utils._is_macos():
          results = mlmodel.predict({"seq": test_input_x})
          np.testing.assert_allclose(
              results["Identity"], expected_val, rtol=1e-4, atol=1e-3
          )
  
          # seq_len below/above lower_bound/upper_bound
          with pytest.raises(
              RuntimeError,
              match=r"Size \(2\) of dimension \(1\) is not in allowed range \(3\.\.5\)",
          ):
              seq_len = 2
              test_input_x = np.random.rand(
                  batch, seq_len, input_dim
              ).astype(np.float32)
              results = mlmodel.predict({"seq": test_input_x})
  
          with pytest.raises(
              RuntimeError,
              match=r"Size \(6\) of dimension \(1\) is not in allowed range \(3\.\.5\)",
          ):
              seq_len = 6
              test_input_x = np.random.rand(
                  batch, seq_len, input_dim
              ).astype(np.float32)
              results = mlmodel.predict({"seq": 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 3 for calling the TestTF2FlexibleInput obj's underlying member method code with example usage: obj.test_tf2keras_outofbound_range_dim(use_symbol, backend) without return types