code: def pattern_to_detect(conv_transpose, transpose, sub):
      """
      Wrapper to create 8 patterns to detect for conciseness.
      """
  
      @mb.program(input_specs=[mb.TensorSpec(shape=arbitrary_input)])
      def conv_bias_pattern(x):
          if not conv_transpose:
              conv = mb.conv(
                  x=x,
                  weight=arbitrary_weight,
                  pad_type="valid",
                  name="conv",
              )
          else:
              conv = mb.conv_transpose(
                  x=x,
                  weight=arbitrary_weight,
                  pad_type="valid",
                  name="conv",
              )
  
          if transpose:
              transpose_layer = mb.transpose(
                  x=conv, perm=arbitrary_perm, name="transpose"
              )
  
          if sub:
              add_or_sub = mb.sub(
                  x=transpose_layer if transpose else conv,
                  y=arbitrary_scalar,
                  name="add_or_sub",
              )
          else:
              add_or_sub = mb.add(
                  x=transpose_layer if transpose else conv,
                  y=arbitrary_scalar,
                  name="add_or_sub",
              )
          return add_or_sub
  
      return conv_bias_pattern
  
file_path: coremltools/coremltools/converters/mil/experimental/passes/generic_conv_bias_fusion.py
imports: import os
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure import register_generic_pass
  from coremltools.converters.mil.mil import types
label_desc: Use image node_id 1 for calling a global function with example usage: pattern_to_detect(conv_transpose, transpose, sub) and returns: conv_bias_pattern, add_or_sub