class_docstr: ShardingStrategy is a dataclass to store the meta information on tensor sharding for a node.
  
  Args:
      name (str): express the sharding strategies in string, such as 'S0S1 = S0R x RS1'.
      output_sharding_spec (ShardingSpec): ShardingSpec of the output node.
      compute_cost (TrainCycleItem): Computation cost to complete this strategy. (default to None)
      communication_cost (TrainCycleItem): Communication cost to complete this strategy. (default to None)
      memory_cost (TrainCycleItem): Memory cost of the output node using this strategy. (default to None)
      input_sharding_specs (List(ShardingSpec)): The ShardingSpecs of the input nodes.
class_docstr_tok: ["ShardingStrategy","is","a","dataclass","to","store","the","meta","information","on","tensor","sharding","for","a","node",".","Args",":","name","(","str",")",":","express","the","sharding","strategies","in","string",",","such","as","'S0S1","=","S0R","x","RS1","'",".","output_sharding_spec","(","ShardingSpec",")",":","ShardingSpec","of","the","output","node",".","compute_cost","(","TrainCycleItem",")",":","Computation","cost","to","complete","this","strategy",".","(","default","to","None",")","communication_cost","(","TrainCycleItem",")",":","Communication","cost","to","complete","this","strategy",".","(","default","to","None",")","memory_cost","(","TrainCycleItem",")",":","Memory","cost","of","the","output","node","using","this","strategy",".","(","default","to","None",")","input_sharding_specs","(","List","(","ShardingSpec",")",")",":","The","ShardingSpecs","of","the","input","nodes","."]
code: def clone(self):
      def _deepcopy_dict_vals(data: Dict):
          return {k: deepcopy(v) for k, v in data.items()}
  
      sharding_specs = (
          _deepcopy_dict_vals(self.sharding_specs)
          if self.sharding_specs is not None
          else None
      )
      # We need to deepcopy it when self.communication_actions is not None, instead of checking its __bool__ value.
      # Consider the examples below:
      # If self.communication_actions is an empty dictionary {}, then self.communication_actions is not None, but its __bool__ value is False.
      # In this case, if we set None to the new object, program will crash when we try to access the communication_actions.items.
      communication_actions = (
          _deepcopy_dict_vals(self.communication_actions)
          if self.communication_actions is not None
          else None
      )
      # same reason as communication_actions
      resharding_costs = (
          _deepcopy_dict_vals(self.resharding_costs)
          if self.resharding_costs is not None
          else None
      )
      compute_cost = deepcopy(self.compute_cost)
      communication_cost = deepcopy(self.communication_cost)
      memory_cost = deepcopy(self.memory_cost)
  
      return ShardingStrategy(
          name=self.name,
          sharding_specs=sharding_specs,
          compute_cost=compute_cost,
          communication_cost=communication_cost,
          memory_cost=memory_cost,
          communication_actions=communication_actions,
          resharding_costs=resharding_costs,
      )
  
imports: from copy import deepcopy
  from dataclasses import dataclass
  from enum import Enum
  from typing import Any, Dict, List, Tuple, Union
  import torch
  from torch.fx.node import Node
  from colossalai.tensor.comm_spec import CommSpec
  from colossalai.tensor.sharding_spec import ShardingSpec
  from .constants import ELEMENTWISE_FUNC_OP, ELEMENTWISE_METHOD_OP, ELEMENTWISE_MODULE_OP, RESHAPE_FUNC_OP, RESHAPE_METHOD_OP
label_desc: Use image node_id 8 for calling the ShardingStrategy obj's underlying member method code with example usage: obj.clone() and returns: ShardingStrategy, unknown