code: def _elementwise_flops_compute(input, other):
      # copied from https://github.com/microsoft/DeepSpeed/blob/master/deepspeed/profiling/flops_profiler/profiler.py#L763
      if not torch.is_tensor(input):
          if torch.is_tensor(other):
              return reduce(operator.mul, other.shape), 0
          else:
              return 1, 0
      elif not torch.is_tensor(other):
          return reduce(operator.mul, input.shape), 0
      else:
          dim_input = len(input.shape)
          dim_other = len(other.shape)
          max_dim = max(dim_input, dim_other)
  
          final_shape = []
          for i in range(max_dim):
              in_i = input.shape[i] if i < dim_input else 1
              ot_i = other.shape[i] if i < dim_other else 1
              if in_i > ot_i:
                  final_shape.append(in_i)
              else:
                  final_shape.append(ot_i)
          flops = reduce(operator.mul, final_shape)
          return flops, 0
  
file_path: colossalai/colossalai/fx/profiler/experimental/profiler_function/arithmetic.py
imports: import operator
  from functools import reduce
  from typing import Any, Optional, Tuple, Union
  import torch
  from ..registry import meta_profiler_function
label_desc: Use image node_id 1 for calling a global function with example usage: _elementwise_flops_compute(input, other) and returns: reduce,  int, int,  int, reduce,  int, flops,  int