class_docstr: Matches patterns to apply transforms in a tf.keras model graph.
docstr: Construct ModelTransformer.
  
  Args:
    model: Keras model to be transformed.
    transforms: List of transforms to be applied to the model.
    candidate_layers: Names of layers which may be transformed. Only layers
      whose names are in candidate_layers are matched against patterns. The
      default is that all layers may be transformed.
    layer_metadata: Dictionary of metadata associated with each layer in the
      model. The keys are layer names.
code: def __init__(
      self,
      model,
      transforms,
      candidate_layers=None,
      layer_metadata=None,
  ):
      """Construct ModelTransformer.
  
      Args:
        model: Keras model to be transformed.
        transforms: List of transforms to be applied to the model.
        candidate_layers: Names of layers which may be transformed. Only layers
          whose names are in candidate_layers are matched against patterns. The
          default is that all layers may be transformed.
        layer_metadata: Dictionary of metadata associated with each layer in the
          model. The keys are layer names.
      """
      if not self._is_sequential_or_functional_model(model):
          raise ValueError(
              "Only tf.keras sequential or functional models can be transformed."
          )
  
      if layer_metadata is None:
          layer_metadata = {}
  
      self.model = model
      self.transforms = transforms
      self.candidate_layers = candidate_layers
      self.layer_metadata = layer_metadata
  
imports: import collections
  import copy
  import re
  import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras.graph_transformations import transforms
label_desc: Use image node_id 1 to create a new ModelTransformer object from inherited base classes: object with example: obj = ModelTransformer(model, transforms, candidate_layers, layer_metadata)