code: def write_report(
      benchmark_results: List[BenchmarkResult],
      report_file: str,
      report_str: str,
      num_requests: int,
  ) -> None:
      for benchmark_res in benchmark_results:
          avg_dur_s, std_dur_s = (
              benchmark_res.total_duration_sec,
              benchmark_res.std_sec,
          )
  
          qps = int(num_requests / avg_dur_s)
  
          mem_allocated_by_rank = benchmark_res.max_mem_allocated
  
          mem_str = ""
          for i, mem_mb in enumerate(mem_allocated_by_rank):
              mem_str += f"Rank {i}: {mem_mb:7} "
  
          report_str += f"{benchmark_res.short_name:40} Avg QPS:{qps:10} Avg Duration: {int(1000*avg_dur_s):5}"
          report_str += (
              f"ms Standard Dev Duration: {(1000*std_dur_s):.2f}ms\n"
          )
          report_str += f"\tMemory Allocated Per Rank:\n\t{mem_str}\n"
  
      with open(report_file, "w") as f:
          f.write(report_str)
  
      logger.info(f"Report written to {report_file}:\n{report_str}")
  
imports: import argparse
  import gc
  import logging
  import os
  import time
  from dataclasses import dataclass
  from enum import Enum
  from typing import Dict, List, Tuple
  import torch
  from torch.autograd.profiler import record_function
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel, ShardingType
  from torchrec.distributed.planner import EmbeddingShardingPlanner, Topology
  from torchrec.distributed.planner.enumerators import EmbeddingEnumerator
  from torchrec.distributed.planner.shard_estimators import EmbeddingPerfEstimator, EmbeddingStorageEstimator
  from torchrec.distributed.shard import _shard_modules
  from torchrec.distributed.test_utils.infer_utils import TestQuantEBCSharder
  from torchrec.distributed.test_utils.test_model import ModelInput
  from torchrec.distributed.types import DataType, ShardingEnv
  from torchrec.fx import symbolic_trace
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.quant.embedding_modules import EmbeddingBagCollection
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, KeyedTensor
label_desc: Use image node_id 8 for calling a global function with example usage: write_report(benchmark_results, report_file, report_str, num_requests) without return types