class_docstr: Attach validator to the trainer engine in Ignite.
  It can support to execute validation every N epochs or every N iterations.
docstr: Args:
      interval: do validation every N epochs or every N iterations during training.
      validator: run the validator when trigger validation, suppose to be Evaluator.
          if None, should call `set_validator()` before training.
      epoch_level: execute validation every N epochs or N iterations.
          `True` is epoch level, `False` is iteration level.
      exec_at_start: whether to execute a validation first when starting the training.
          default to `False`. It can be useful especially for some transfer-learning cases
          to validate the initial model before training.
  
  Raises:
      TypeError: When ``validator`` is not a ``monai.engines.evaluator.Evaluator``.
docstr_tok: ["Args",":","interval",":","do","validation","every","N","epochs","or","every","N","iterations","during","training",".","validator",":","run","the","validator","when","trigger","validation",",","suppose","to","be","Evaluator",".","if","None",",","should","call","`","set_validator","(",")","`","before","training",".","epoch_level",":","execute","validation","every","N","epochs","or","N","iterations",".","`","True","`","is","epoch","level",",","`","False","`","is","iteration","level",".","exec_at_start",":","whether","to","execute","a","validation","first","when","starting","the","training",".","default","to","`","False","`",".","It","can","be","useful","especially","for","some","transfer-learning","cases","to","validate","the","initial","model","before","training",".","Raises",":","TypeError",":","When","``","validator","``","is","not","a","``","monai.engines.evaluator.Evaluator","``","."]
code: def __init__(
      self,
      interval: int,
      validator: Evaluator | None = None,
      epoch_level: bool = True,
      exec_at_start: bool = False,
  ) -> None:
      """
      Args:
          interval: do validation every N epochs or every N iterations during training.
          validator: run the validator when trigger validation, suppose to be Evaluator.
              if None, should call `set_validator()` before training.
          epoch_level: execute validation every N epochs or N iterations.
              `True` is epoch level, `False` is iteration level.
          exec_at_start: whether to execute a validation first when starting the training.
              default to `False`. It can be useful especially for some transfer-learning cases
              to validate the initial model before training.
  
      Raises:
          TypeError: When ``validator`` is not a ``monai.engines.evaluator.Evaluator``.
  
      """
      if validator is not None and not isinstance(validator, Evaluator):
          raise TypeError(
              f"validator must be a monai.engines.evaluator.Evaluator but is {type(validator).__name__}."
          )
      self.validator = validator
      self.interval = interval
      self.epoch_level = epoch_level
      self.exec_at_start = exec_at_start
  
file_path: MONAI/monai/handlers/validation_handler.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from monai.config import IgniteInfo
  from monai.engines.evaluator import Evaluator
  from monai.utils import min_version, optional_import
label_desc: Use image node_id 1 to create a new ValidationHandler object  with example: obj = ValidationHandler(interval, validator, epoch_level, exec_at_start)