code: def calculate_fwd_tmp(n: Node) -> int:
      """A helper function to calculate `fwd_tmp` (with sharding spec)
      Currently, `torch.nn.ReLU` behaves weirdly, so we have to patch it for accuracy.
  
      Args:
          n (Node): a node from the graph
  
      Returns:
          fwd_tmp (int): the result of `fwd_tmp`
      """
  
      # TODO(super-dainiu): should divide the memory by sharding spec
      def is_relu_like_node(n: Node) -> bool:
          """Check if a node is a ReLU-like node.
          ReLU-like nodes have the following properties:
          - They are either `call_function` or `call_module`
          - Their output tensors are directly saved for backward
          - Their input tensors are not saved for backward
  
          An example is `torch.nn.functional.softmax` which has (forward + backward):
          def forward(self, input_2):
              _softmax_default = torch.ops.aten._softmax.default(input_2, None, None);  input_2 = None
              zeros_like_default = torch.ops.aten.zeros_like.default(_softmax_default, dtype = None, layout = None, device = None, pin_memory = None)
              detach_default = torch.ops.aten.detach.default(_softmax_default);  _softmax_default = None
              _softmax_backward_data_default = torch.ops.aten._softmax_backward_data.default(zeros_like_default, detach_default, None, None);  zeros_like_default = detach_default = None
              detach_default_1 = torch.ops.aten.detach.default(_softmax_backward_data_default);  _softmax_backward_data_default = None
              detach_default_2 = torch.ops.aten.detach.default(detach_default_1);  detach_default_1 = None
  
          Args:
              n (Node): A node from the graph
  
          Returns:
              bool: Whether the node is a ReLU-like node
          """
          if n.op == "call_function":
              return n.target in OUTPUT_SAVED_OPS
          elif n.op == "call_module":
              return (
                  type(n.graph.owning_module.get_submodule(n.target))
                  in OUTPUT_SAVED_MOD
              )
          return False
  
      if not is_relu_like_node(n):
          return activation_size(n.meta["fwd_tmp"])
      return 0
  
file_path: colossalai/colossalai/fx/profiler/shard_utils.py
imports: import torch
  from torch.fx import Node
  from .._compatibility import compatibility, is_compatible_with_meta
  from .memory_utils import activation_size
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_fwd_tmp(n) and returns: int, False, activation_size, unknown, unknown