class_docstr: This is a class tending for easy deployments of users' training and evaluation instead of
  writing their own scripts. It is similar with ``ignite.engine`` and ``keras.engine``, but is
  called `Trainer`.
  
  Args:
      engine (:class:`Engine`): Engine responsible for the process function.
      timer (:class:`MultiTimer`, optional): Timer used to monitor the whole training.
      logger (:class:`colossalai.logging.DistributedLogger`, optional): Logger used to record the whole training log.
  
  
  Examples:
      >>> # define model, criterion, optimizer, lr_scheduler, train_dataloader for your training
      >>> model = ...
      >>> criterion = ...
      >>> optimizer = ...
      >>> train_dataloader = ...
      >>> # Initialize your engine, train_dataloader, test_dataloader, lr_scheduler
      >>> engine, train_dataloader, _, _ = colossalai.initialize(model, optimizer, criterion)
      >>> # Beginning training progress
      >>> timer = ...
      >>> logger = ...
      >>> trainer = Trainer(engine=engine, logger=logger, timer=timer)
      >>> # add hooks you would like to use here.
      >>> hook_list = []
      >>> trainer.fit(
      >>>    train_dataloader=train_dataloader,
      >>>    epochs=gpc.config.NUM_EPOCHS,
      >>>    test_interval=1,
      >>>    hooks=hook_list,
      >>>    display_progress=True,
      >>>    return_output_label=False
      >>>    )
  
  More examples and details could be found in
  `Training with engine and trainer <https://www.colossalai.org/docs/basics/engine_trainer>`_
  and `ColossalAI-Examples <https://github.com/hpcaitech/ColossalAI-Examples/tree/main>`_.
docstr: Evaluates the model with testing data.
  
  Args:
      test_dataloader (:class:`torch.utils.data.DataLoader`, optional): Dataloader for testing.
      hooks (list, optional): A list of hooks used in evaluation. Defaults to None.
      display_progress (bool, optional): If True, the evaluation progress will be printed. Defaults to False.
      return_output_label (bool, optional): If True, the output of model and the label
          will be returned. Defaults to True.
docstr_tok: ["Evaluates","the","model","with","testing","data",".","Args",":","test_dataloader","(",":","class",":","`","torch.utils.data.DataLoader","`",",","optional",")",":","Dataloader","for","testing",".","hooks","(","list",",","optional",")",":","A","list","of","hooks","used","in","evaluation",".","Defaults","to","None",".","display_progress","(","bool",",","optional",")",":","If","True",",","the","evaluation","progress","will","be","printed",".","Defaults","to","False",".","return_output_label","(","bool",",","optional",")",":","If","True",",","the","output","of","model","and","the","label","will","be","returned",".","Defaults","to","True","."]
code: def evaluate(
      self,
      test_dataloader: DataLoader,
      hooks: List[BaseHook] = None,
      display_progress: bool = False,
      return_output_label: bool = True,
  ):
      """Evaluates the model with testing data.
  
      Args:
          test_dataloader (:class:`torch.utils.data.DataLoader`, optional): Dataloader for testing.
          hooks (list, optional): A list of hooks used in evaluation. Defaults to None.
          display_progress (bool, optional): If True, the evaluation progress will be printed. Defaults to False.
          return_output_label (bool, optional): If True, the output of model and the label
              will be returned. Defaults to True.
      """
      # set display
      display_progress = self._should_display_progress(display_progress)
  
      # reset hooks
      self._reset_states()
      if hooks is not None:
          assert isinstance(
              hooks, list
          ), f"expected argument hooks be to list, but got {type(hooks)}"
      else:
          hooks = []
      self.hooks = hooks
      self.hooks.sort(key=lambda hook: hook.priority)
      if self._verbose:
          for hook in self.hooks:
              self._logger.info(
                  f"Using {hook.__class__.__name__} for training, priority = {hook.priority}",
                  ranks=[0],
              )
          self._logger.info(
              "Lower value means higher priority for calling hook function",
              ranks=[0],
          )
      self._call_hooks("after_hook_is_attached")
  
      # eval
      self._eval(
          test_dataloader=test_dataloader,
          display_progress=display_progress,
          return_output_label=return_output_label,
      )
  
imports: from typing import Any, List, Union
  import torch
  from torch.utils.data import DataLoader
  from tqdm import tqdm
  from colossalai.legacy.engine import Engine
  from colossalai.legacy.trainer.hooks import BaseHook
  from colossalai.legacy.utils import is_dp_rank_0, is_no_pp_or_last_stage, is_tp_rank_0
  from colossalai.logging import DistributedLogger
  from colossalai.utils import MultiTimer
label_desc: Use image node_id 18 for calling the Trainer obj's underlying member method code with example usage: obj.evaluate(test_dataloader, hooks, display_progress, return_output_label) without return types