code: def __init__(
      self,
      datamodules: List[pl.LightningDataModule],
      config: Config = None,
      dataset_type: str = "train",
  ):
      self.test_reporter_config = OmegaConf.merge(
          OmegaConf.structured(self.Config), config
      )
      self.datamodules = datamodules
      self.dataset_type = dataset_type
      self.config = registry.get("config")
      self.report = []
      self.timer = Timer()
      self.training_config = self.config.training
      self.num_workers = self.training_config.num_workers
      self.batch_size = self.training_config.batch_size
      self.report_folder_arg = get_mmf_env(key="report_dir")
      self.experiment_name = self.training_config.experiment_name
  
      self.current_datamodule_idx = -1
      self.dataset_names = list(self.datamodules.keys())
      self.current_datamodule = self.datamodules[
          self.dataset_names[self.current_datamodule_idx]
      ]
      self.current_dataloader = None
  
      self.save_dir = get_mmf_env(key="save_dir")
      self.report_folder = ckpt_name_from_core_args(self.config)
      self.report_folder += foldername_from_config_override(self.config)
  
      self.report_folder = os.path.join(
          self.save_dir, self.report_folder
      )
      self.report_folder = os.path.join(self.report_folder, "reports")
  
      if self.report_folder_arg:
          self.report_folder = self.report_folder_arg
  
      self.candidate_fields = self.test_reporter_config.candidate_fields
  
      PathManager.mkdirs(self.report_folder)
  
      log_class_usage("TestReporter", self.__class__)
  
imports: import csv
  import json
  import logging
  import os
  import warnings
  from dataclasses import dataclass, field
  from typing import List
  import pytorch_lightning
  from mmf.common.registry import registry
  from mmf.common.sample import convert_batch_to_sample_list
  from mmf.utils.configuration import get_mmf_env
  from mmf.utils.distributed import gather_tensor, is_main
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import ckpt_name_from_core_args, foldername_from_config_override
  from mmf.utils.logger import log_class_usage
  from mmf.utils.timer import Timer
  from omegaconf import OmegaConf
  from torch.utils.data import Dataset
label_desc: Use image node_id 1 to create a new TestReporter object from inherited base classes: Dataset with example: obj = TestReporter(datamodules, config, dataset_type)