docstr: Prepares tf model in different formats (keras model, h5 file, saved_model dir).
docstr_tok: ["Prepares","tf","model","in","different","formats","(","keras","model",",","h5","file",",","saved_model","dir",")","."]
code: def setup_class(cls):
      """Prepares tf model in different formats (keras model, h5 file, saved_model dir)."""
      input_1 = tf.keras.Input(shape=(None, None, 16), name="input_1")
      input_2 = tf.keras.Input(shape=(None, None, 4), name="input_2")
      x = (
          tf.keras.layers.Dense(4, activation=tf.nn.relu)(input_1)
          + input_2
      )
      outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x)
      cls.model = tf.keras.Model(
          inputs=[input_1, input_2], outputs=outputs
      )
  
      cls.temp_dir = tempfile.TemporaryDirectory()
      cls.h5_model_path = os.path.join(
          cls.temp_dir.name, "tf_keras_model.h5"
      )
      cls.model.save(cls.h5_model_path)
      cls.saved_model_path = os.path.join(
          cls.temp_dir.name, "saved_model"
      )
      cls.model.save(cls.saved_model_path, save_format="tf")
  
imports: import itertools
  import os
  import tempfile
  import numpy
  import PIL.Image
  import pytest
  import coremltools
  from coremltools._deps import _HAS_TF_2, _HAS_TORCH, MSG_TF2_NOT_FOUND, MSG_TORCH_NOT_FOUND
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.testing_reqs import backends, compute_units
label_desc: Use image node_id 1 for calling the TestFlexibleInputShapesTF obj's underlying member method code with example usage: obj.setup_class(cls) without return types