class_docstr: Matches patterns to apply transforms in a tf.keras model graph.
docstr: Check if ModelTransformer supports transformations given number of inputs and outputs at a layer.
  
  Args:
    layer: layer for pattern matching. Must come from a Functional model.
    is_head_node: whether this is the head node (e.g. in A -> B , B is the
      head node).
  
  Returns:
    whether match is supported.
code: def _is_match_supported(self, layer, is_head_node):
      """Check if ModelTransformer supports transformations given number of inputs and outputs at a layer.
  
      Args:
        layer: layer for pattern matching. Must come from a Functional model.
        is_head_node: whether this is the head node (e.g. in A -> B , B is the
          head node).
  
      Returns:
        whether match is supported.
      """
  
      inbound_nodes = layer["inbound_nodes"]
  
      if len(inbound_nodes) > 1:
          # `layer` is re-used for more than 1 connection from previous layers. If
          # a pattern matches one set of inputs and is replaced, it will break the
          # other connection.
          #
          # Note that theoretically it's possible to have multiple connections have
          # exactly the same pattern, and in that case the transform might be
          # applied. But that's a very complicated edge case not worth handling.
          return False
  
      # If a layer has multiple inbound nodes, it will produce multiple outbound
      # connections as well. Hence no need to explicitly check that.
  
      consuming_layers = self._get_consuming_layers(layer)
      output_consumers = self._get_output_consumers(layer)
      if len(consuming_layers) + len(output_consumers) > 1:
          # Even if a layer has only 1 incoming connection, multiple layers may
          # still consume the output. Having multiple consumers is only supported
          # for the head node, and not intermediate layers. Replacing intermediate
          # nodes with >1 consumer will lead to dangling nodes.
          #
          # Note that theoretically, intermediate layers can supported, as a part
          # of a general layer transform tool. This is not supported given no
          # motivating use case.
          if not is_head_node:
              return False
  
      return True
  
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 14 for calling the ModelTransformer obj's underlying member method code with example usage: obj._is_match_supported(layer, is_head_node) and returns: True, False, False