class_docstr: Attach validator to the trainer engine in Ignite.
  It can support to execute validation every N epochs or every N iterations.
docstr: Set validator if not setting in the __init__().
docstr_tok: ["Set","validator","if","not","setting","in","the","__init__","(",")","."]
code: def set_validator(self, validator: Evaluator) -> None:
      """
      Set validator if not setting in the __init__().
      """
      if not isinstance(validator, Evaluator):
          raise TypeError(
              f"validator must be a monai.engines.evaluator.Evaluator but is {type(validator).__name__}."
          )
      self.validator = validator
  
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 2 for calling the ValidationHandler obj's underlying member method code with example usage: obj.set_validator(validator) without return types