code: def torch_nn_rnn(
      self: torch.nn.RNNBase,
      input: torch.Tensor,
      hx: Optional[torch.Tensor] = None,
  ) -> Tuple[int, int]:
      flops = 0
      macs = 0
      for i in range(self.num_layers):
          w_ih = self.__getattr__("weight_ih_l" + str(i))
          w_hh = self.__getattr__("weight_hh_l" + str(i))
          flops, macs = _rnn_flops(flops, macs, self, w_ih, w_hh)
          if self.bias:
              b_ih = self.__getattr__("bias_ih_l" + str(i))
              b_hh = self.__getattr__("bias_hh_l" + str(i))
              flops += reduce(operator.mul, b_ih) + reduce(
                  operator.mul, b_hh
              )
      flops *= reduce(operator.mul, input.shape[:2])
      macs *= reduce(operator.mul, input.shape[:2])
      if self.bidirectional:
          flops *= 2
          macs *= 2
      return flops, macs
  
file_path: colossalai/colossalai/fx/profiler/experimental/profiler_module/rnn.py
imports: import operator
  from functools import reduce
  from typing import Optional, Tuple
  import torch
  from ..registry import meta_profiler_module
label_desc: Use image node_id 2 for calling a global function with example usage: torch_nn_rnn(input, hx) and returns: flops,  macs