class_docstr: A graph optimization pass on PyMIL to detect and fuse several variants of ``layer_norm`` or
  ``instance_norm``. Pattern 1 corresponds to either ``layer_norm`` or ``instance_norm``. Patterns 2-4
  are ``instance_norm``. Pattern 5 is ``layer_norm``. You can find these patterns in the methods for
  this class in the source code. To quickly view the source code, click the **[source]** button at
  the end of the class definition.
code: def _fuse_layernorm_or_instancenorm_block(self, block: Block):
      fusion_status = False
      for i, op in enumerate(list(block.operations)):
          for b in op.blocks:
              block_changed = True
              while block_changed:
                  block_changed = (
                      self._fuse_layernorm_or_instancenorm_block(b)
                  )
          if len(op.blocks) > 0:
              continue
  
          # start pattern match if reduce_mean op is encountered
          if op.op_type == "reduce_mean":
              if fusion_status is False:
                  fusion_status = (
                      self._try_match_and_transform_pattern_1(op, block)
                  )
              if fusion_status is False:
                  fusion_status = (
                      self._try_match_and_transform_pattern_2(op, block)
                  )
              if fusion_status is False:
                  fusion_status = (
                      self._try_match_and_transform_pattern_3(op, block)
                  )
              if fusion_status is False:
                  fusion_status = (
                      self._try_match_and_transform_pattern_5(op, block)
                  )
              # has to break as the downstream iterator is affected.
              if fusion_status:
                  return fusion_status
          elif op.op_type == "reduce_sum":
              if fusion_status is False:
                  fusion_status = (
                      self._try_match_and_transform_pattern_4(op, block)
                  )
              # has to break as the downstream iterator is affected.
              if fusion_status:
                  return fusion_status
      return fusion_status
  
imports: from typing import List, Optional
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil.mil import Block
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Operation, Program, Var
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import _check_no_output_connection, block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 11 for calling the fuse_layernorm_or_instancenorm obj's underlying member method code with example usage: obj._fuse_layernorm_or_instancenorm_block(block) and returns: fusion_status, fusion_status, fusion_status