code: def testReplaceChainOfLayers_WithSingleLayer(self, model_type):
      class FuseReLUIntoDense(transforms.Transform):
          """Fuse ReLU into Dense layers."""
  
          def pattern(self):
              return LayerPattern(
                  "ReLU", inputs=[LayerPattern("Dense")]
              )
  
          def replacement(self, match_layer):
              dense_layer_config = match_layer.input_layers[0].layer[
                  "config"
              ]
              dense_layer_weights = match_layer.input_layers[0].weights
              dense_layer_config["activation"] = "relu"
  
              new_dense_layer = keras.layers.Dense(**dense_layer_config)
  
              replace_layer = quantize_utils.serialize_layer(
                  new_dense_layer, use_legacy_format=True
              )
              replace_layer["name"] = replace_layer["config"]["name"]
  
              return LayerNode(replace_layer, dense_layer_weights, [])
  
      if model_type == "functional":
          inp = keras.layers.Input((3,))
          out = keras.layers.Dense(2, activation="relu")(inp)
          model_fused = keras.Model(inp, out)
      else:
          model_fused = keras.Sequential(
              [
                  keras.layers.Dense(
                      2, activation="relu", input_shape=(3,)
                  )
              ]
          )
  
      # Ensures old Keras serialization format
      model_fused.use_legacy_config = True
  
      if model_type == "functional":
          inp = keras.layers.Input((3,))
          x = keras.layers.Dense(2)(inp)
          out = keras.layers.ReLU()(x)
          model = keras.Model(inp, out)
      else:
          model = keras.Sequential(
              [
                  keras.layers.Dense(2, input_shape=(3,)),
                  keras.layers.ReLU(),
              ]
          )
      model.set_weights(model_fused.get_weights())
  
      transformed_model, _ = ModelTransformer(
          model, [FuseReLUIntoDense()]
      ).transform()
  
      self._assert_config(
          model_fused.get_config(),
          transformed_model.get_config(),
          # Layers have different names in the models, but same config.
          # Consider verifying the names loosely.
          #
          # build_input_shape is a TensorShape object and the two objects are not
          # considered the same even though the shapes are the same.
          [
              "input_layers",
              "output_layers",
              "name",
              "inbound_nodes",
              "build_input_shape",
          ],
      )
  
      self._assert_model_results_equal(model, transformed_model)
      self._assert_model_results_equal(model_fused, transformed_model)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras import utils
  from tensorflow_model_optimization.python.core.quantization.keras.graph_transformations import model_transformer
  from tensorflow_model_optimization.python.core.quantization.keras.graph_transformations import transforms
label_desc: Use image node_id 15 for calling the ModelTransformerTest obj's underlying member method code with example usage: obj.testReplaceChainOfLayers_WithSingleLayer(model_type) and returns: LayerPattern, LayerNode