code: def train_on_batches(self, iterator: DataLearningIterator) -> None:
      self._chainer.get_main_component().model.train()
      super(TorchTrainer, self).train_on_batches(iterator=iterator)
      self._chainer.get_main_component().model.eval()
  
file_path: DeepPavlov/deeppavlov/core/trainers/torch_trainer.py
imports: from logging import getLogger
  from typing import Tuple, Optional, Iterable, Collection, Any
  from deeppavlov.core.trainers.utils import Metric
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.data_learning_iterator import DataLearningIterator
  from deeppavlov.core.trainers.nn_trainer import NNTrainer
label_desc: Use image node_id 2 for calling the TorchTrainer obj's underlying member method code with example usage: obj.train_on_batches(iterator) without return types