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 apply(self, prog: Program):
      for f in prog.functions.values():
          block_changed = True
          while block_changed:
              if self._DEBUG:
                  import graphviz
  
                  graphviz.Source(
                      f.get_dot_string(
                          highlight_debug_op_types=["instance_norm"],
                      )
                  ).view(
                      filename="/tmp/block_before_fuse_layernorm_or_instancenorm"
                  )
              logger.debug(
                  "Block before fuse_layernorm_or_instancenorm transform:\n{}".format(
                      f
                  )
              )
  
              block_changed = (
                  self._fuse_layernorm_or_instancenorm_block(f)
              )
  
              if self._DEBUG:
                  graphviz.Source(
                      f.get_dot_string(
                          highlight_debug_op_types=["instance_norm"],
                      )
                  ).view(
                      filename="/tmp/block_after_fuse_layernorm_or_instancenorm"
                  )
  
              logger.debug(
                  "Block after fuse_layernorm_or_instancenorm transform:\n{}".format(
                      f
                  )
              )
  
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 1 for calling the fuse_layernorm_or_instancenorm obj's underlying member method code with example usage: obj.apply(prog) without return types