code: def test_flops_profiler_in_inference(self):
      mod = LeNet5(10)
      batch_size = 1024
      input = torch.randn(batch_size, 1, 32, 32)
      flops, macs, params = get_model_profile(
          mod,
          tuple(input.shape),
          print_profile=True,
          detailed=True,
          module_depth=-1,
          top_modules=3,
          warm_up=1,
          as_string=False,
          ignore_modules=None,
      )
      print(flops, macs, params)
      assert within_range(flops, 866076672, TOLERANCE)
      assert within_range(macs, 426516480, TOLERANCE)
      assert params == 61706
  
file_path: DeepSpeed/tests/unit/profiling/flops_profiler/test_flops_profiler.py
imports: import torch
  import pytest
  import deepspeed
  from deepspeed.profiling.flops_profiler import get_model_profile
  from unit.simple_model import SimpleModel, random_dataloader
  from unit.common import DistributedTest
  from deepspeed.runtime.utils import required_torch_version
  from deepspeed.accelerator import get_accelerator
label_desc: Use image node_id 2 for calling the TestFlopsProfiler obj's underlying member method code with example usage: obj.test_flops_profiler_in_inference() without return types