docstr: Verifies a layer replaced using a transform can be replaced again.
docstr_tok: ["Verifies","a","layer","replaced","using","a","transform","can","be","replaced","again","."]
code: def testReplace_AlreadyReplacedLayer_WithAnotherMatch(
      self, model_type
  ):
      """Verifies a layer replaced using a transform can be replaced again."""
  
      class ReplaceReLUWithSoftmax(Transform):
          def pattern(self):
              return LayerPattern("ReLU")
  
          def replacement(self, match_layer):
              replace_layer = quantize_utils.serialize_layer(
                  keras.layers.Softmax(), use_legacy_format=True
              )
              replace_layer["name"] = replace_layer["config"]["name"]
              return LayerNode(replace_layer)
  
      class ReplaceSoftmaxWithELU(Transform):
          def pattern(self):
              return LayerPattern("Softmax")
  
          def replacement(self, match_layer):
              replace_layer = quantize_utils.serialize_layer(
                  keras.layers.ELU(), use_legacy_format=True
              )
              replace_layer["name"] = replace_layer["config"]["name"]
              return LayerNode(replace_layer)
  
      model = self._simple_dense_model(model_type)
      transformed_model, _ = ModelTransformer(
          model,
          [ReplaceReLUWithSoftmax(), ReplaceSoftmaxWithELU()],
          candidate_layers=set([layer.name for layer in model.layers]),
      ).transform()
  
      self.assertEqual(
          transformed_model.layers[-1].__class__.__name__, "ELU"
      )
  
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 20 for calling the ModelTransformerTest obj's underlying member method code with example usage: obj.testReplace_AlreadyReplacedLayer_WithAnotherMatch(model_type) and returns: LayerPattern, LayerNode, LayerPattern, LayerNode