code: def test(self):
      config_dict = {
          "train_batch_size": 1,
          "steps_per_print": 1,
          "optimizer": {
              "type": "Adam",
              "params": {
                  "lr": 0.001,
              },
          },
          "zero_optimization": {"stage": 0},
          "fp16": {
              "enabled": True,
          },
          "flops_profiler": {
              "enabled": True,
              "step": 1,
              "module_depth": -1,
              "top_modules": 3,
          },
      }
      hidden_dim = 10
      model = SimpleModel(hidden_dim, empty_grad=False)
  
      model, _, _, _ = deepspeed.initialize(
          config=config_dict,
          model=model,
          model_parameters=model.parameters(),
      )
  
      data_loader = random_dataloader(
          model=model,
          total_samples=50,
          hidden_dim=hidden_dim,
          device=model.device,
          dtype=torch.half,
      )
      for n, batch in enumerate(data_loader):
          loss = model(batch[0], batch[1])
          model.backward(loss)
          model.step()
          if n == 3:
              break
      assert within_range(
          model.flops_profiler.flops, 200, tolerance=TOLERANCE
      )
      assert model.flops_profiler.params == 110
  
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 1 for calling the TestFlopsProfiler obj's underlying member method code with example usage: obj.test() without return types