code: def _meta_data_computing_v0(
      meta_args, root, kind, target, args, kwargs
  ):
      if (
          kind == "placeholder"
          and target in meta_args
          and meta_args[target].is_meta
      ):
          meta_out = meta_args[target]
          return meta_out
  
      if target in [
          getattr(torch, torch_func) for torch_func in _TorchNewMethod
      ]:
          # NOTE: tensor constructors in PyTorch define the `device` argument as
          # *kwargs-only*. That is why this works. If you add methods to
          # _TORCH_METHODS_TO_PATCH that do not define `device` as kwarg-only,
          # this will break and you will likely see issues where we cannot infer
          # the size of the output.
          if "device" in kwargs:
              kwargs["device"] = "meta"
  
      try:
          unwrap_fn = (
              lambda n: n._meta_data if isinstance(n, Node) else n
          )
          args_metas = tree_map(unwrap_fn, args)
          kwargs_metas = tree_map(unwrap_fn, kwargs)
  
          if kind == "call_function":
              # fetch patched function
              if meta_patched_function.has(target):
                  meta_target = meta_patched_function.get(target)
              elif meta_patched_function.has(target.__name__):
                  # use name for some builtin op like @ (matmul)
                  meta_target = meta_patched_function.get(
                      target.__name__
                  )
              else:
                  meta_target = target
  
              meta_out = meta_target(*args_metas, **kwargs_metas)
  
              if isinstance(meta_out, torch.Tensor):
                  meta_out = meta_out.to(device="meta")
          elif kind == "call_method":
              method = getattr(args_metas[0].__class__, target)
  
              # fetch patched method
              if meta_patched_function.has(method):
                  meta_target = meta_patched_function.get(method)
              else:
                  meta_target = method
  
              meta_out = meta_target(*args_metas, **kwargs_metas)
          elif kind == "call_module":
              mod = root.get_submodule(target)
              mod_type = type(mod)
              if meta_patched_module.has(mod_type):
                  meta_out = meta_patched_module.get(mod_type)(
                      mod, *args_metas, **kwargs_metas
                  )
              else:
                  meta_out = mod(*args_metas, **kwargs_metas)
          elif kind == "get_attr":
              attr_itr = root
              atoms = target.split(".")
              for atom in atoms:
                  attr_itr = getattr(attr_itr, atom)
              if isinstance(attr_itr, torch.nn.parameter.Parameter):
                  meta_out = torch.nn.Parameter(
                      attr_itr.to(device="meta")
                  )
              elif isinstance(attr_itr, torch.Tensor):
                  meta_out = attr_itr.to(device="meta")
              else:
                  meta_out = attr_itr
          else:
              return None
  
      except Exception as e:
          raise RuntimeError(
              f"Could not compute metadata for {kind} target {target}: {e}"
          )
  
      return meta_out
  
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 6 for calling a global function with example usage: _meta_data_computing_v0(meta_args, root, kind, target, args, kwargs) and returns: meta_out, meta_out, None