class_docstr: ShardMetaInfo class
  This class is used to store meta info based on sharding strategy and the given
  target function.
docstr: Compute meta info based on sharding strategy and the given target function.
docstr_tok: ["Compute","meta","info","based","on","sharding","strategy","and","the","given","target","function","."]
code: def compute_shard_metainfo(self):
      """
      Compute meta info based on sharding strategy and the given target function.
      """
      assert meta_register.has(
          self._target.__class__
      ) or meta_register.has(
          self._target
      ), f"Meta info for {self._target} is not registered."
      if meta_register.has(self._target.__class__):
          # module
          meta_func = meta_register.get(self._target.__class__)
  
          # check whether the target in the list that we don't need to save activation
          save_fwd_in = self._target.__class__ not in NO_SAVE_ACTIVATION
      else:
          # function
          meta_func = meta_register.get(self._target)
  
          # check whether the target in the list that we don't need to save activation
          save_fwd_in = self._target.__class__ not in NO_SAVE_ACTIVATION
  
      # construct args for meta_func
      args = [
          self.compute_sharded_opdata(k, v)
          for k, v in self._strategy.sharding_specs.items()
      ]
  
      # construct kwargs
      if self.target in INPLACE_MODULE:
          kwargs = {"inplace": self.target.inplace}
      elif self.target in INPLACE_OPS:
          kwargs = {"inplace": True}
      else:
          kwargs = {"inplace": False}
  
      # compute metainfo with meta_func
      (
          self.compute_cost,
          self.memory_cost,
          self.fwd_in,
          self.fwd_buffer,
          self.fwd_out,
      ) = meta_func(*args, **kwargs)
  
      # process corner case for NO_SAVE_ACTIVATION
      if not save_fwd_in:
          self.fwd_in = []
  
file_path: colossalai/colossalai/auto_parallel/meta_profiler/shard_metainfo.py
imports: from typing import Callable, List
  import torch
  from colossalai.auto_parallel.tensor_shard.sharding_strategy import OperationData, ShardingStrategy, TrainCycleItem
  from colossalai.tensor.sharding_spec import ShardingSpec
  from .constants import INPLACE_MODULE, INPLACE_OPS, NO_SAVE_ACTIVATION
  from .registry import meta_register
label_desc: Use image node_id 7 for calling the ShardMetaInfo obj's underlying member method code with example usage: obj.compute_shard_metainfo() without return types