code: def bias_addition_pass(
      gm: ColoGraphModule,
      root_model: torch.nn.Module,
      meta_args: Optional[Dict[str, Any]] = None,
  ):
      result_graph = Graph()
      value_remap = {}
      unwrap_fn = lambda n: n._meta_data if isinstance(n, Node) else n
  
      for orig_node in gm.graph.nodes:
          assert hasattr(orig_node, "_meta_data")
          kind = orig_node.op
          target = orig_node.target
          args = orig_node.args
          kwargs = orig_node.kwargs
  
          args_metas = tree_map(unwrap_fn, args)
          tracer = ColoTracer()
          tracer.graph = Graph(tracer_cls=ColoTracer)
          tracer.root = root_model
  
          def wrap_fn(n):
              if isinstance(n, Node):
                  proxy = ColoProxy(n, tracer)
                  proxy.meta_data = n._meta_data
                  return proxy
              return n
  
          args_proxy = tree_map(wrap_fn, args)
          kwargs_proxy = tree_map(wrap_fn, kwargs)
  
          handle = None
          if kind == "call_function":
              if bias_addition_function.has(target):
                  if target == torch.nn.functional.linear:
                      if (
                          "bias" in kwargs
                          and kwargs["bias"] is not None
                      ):
                          function_to_substitute = func_to_func_dict[
                              target
                          ]
                          handle = bias_addition_function.get(target)(
                              tracer,
                              target,
                              args_proxy,
                              kwargs_proxy,
                              function_to_substitute,
                          )
                  else:
                      function_to_substitute = func_to_func_dict[target]
                      handle = bias_addition_function.get(target)(
                          tracer,
                          target,
                          args_proxy,
                          kwargs_proxy,
                          function_to_substitute,
                      )
              elif bias_addition_function.has(target.__name__):
                  # use name for some builtin op like @ (matmul)
                  function_to_substitute = func_to_func_dict[target]
                  handle = bias_addition_function.get(target.__name__)(
                      tracer,
                      target,
                      args_proxy,
                      kwargs_proxy,
                      function_to_substitute,
                  )
  
          elif kind == "call_method":
              method = getattr(args_metas[0].__class__, target)
              if bias_addition_method.has(method):
                  function_to_substitute = method_to_func_dict[method]
                  handle = bias_addition_method.get(method)(
                      tracer,
                      target,
                      args_proxy,
                      kwargs_proxy,
                      function_to_substitute,
                  )
  
          elif kind == "call_module":
              # if not hasattr(self, "orig_forward"):
              #     raise AttributeError(f"{self} does not have an attribute called orig_forward")
              mod = gm.get_submodule(target)
              mod_type = type(mod)
              if (
                  bias_addition_module.has(mod_type)
                  and mod.bias is not None
              ):
                  function_to_substitute = module_to_func_dict[mod_type]
                  handle = bias_addition_module.get(mod_type)(
                      tracer,
                      target,
                      args_proxy,
                      kwargs_proxy,
                      function_to_substitute,
                  )
  
          if handle is not None:
              handle.generate()
              for node_inserted in tracer.graph.nodes:
                  value_remap[node_inserted] = result_graph.node_copy(
                      node_inserted, lambda n: value_remap[n]
                  )
                  last_node = value_remap[node_inserted]
              value_remap[orig_node] = last_node
          else:
              value_remap[orig_node] = result_graph.node_copy(
                  orig_node, lambda n: value_remap[n]
              )
  
          del tracer
  
      gm.graph = result_graph
      gm.recompile()
      meta_prop_pass(gm, root_model, meta_args)
  
imports: import functools
  import inspect
  import operator
  from contextlib import contextmanager
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
  import torch
  from torch.fx import Graph, Node, Proxy, Tracer
  from torch.utils._pytree import tree_map
  from colossalai.fx import ColoGraphModule, compatibility, is_compatible_with_meta
  from colossalai.fx.tracer._tracer_utils import is_element_in_list
  from colossalai.fx.tracer.bias_addition_patch import func_to_func_dict, method_to_func_dict, module_to_func_dict
  from colossalai.fx.tracer.registry import bias_addition_function, bias_addition_method, bias_addition_module, meta_patched_function, meta_patched_module
label_desc: Use image node_id 7 for calling a global function with example usage: bias_addition_pass(gm, root_model, meta_args) and returns: n, proxy