code: def iterate(self, params, repetition, iteration):
      
      try:
        print("\nStarting iteration",iteration)
        t1 = time.time()
        ret = {}
  
        # Update learning rate using learning rate scheduler if configured
        if self.lr_scheduler is not None:
          # ReduceLROnPlateau lr_scheduler step should be called after validation,
          # all other lr_schedulers should be called before training
          if params["lr_scheduler"] != "ReduceLROnPlateau":
            self.lr_scheduler.step()
  
        self.train(params, epoch=iteration)
  
        # Run validation test
        if self.validation_loader is not None:
          validation = self.test(params, self.validation_loader)
  
          # ReduceLROnPlateau step should be called after validation
          if params["lr_scheduler"] == "ReduceLROnPlateau":
            self.lr_scheduler.step(validation["test_loss"])
  
          ret["validation"] = validation
          print("Validation: Test error=", validation["testerror"],
                "entropy=", validation["entropy"])
  
        # Run noise test
        if (params["test_noise_every_epoch"] or
            iteration == params["iterations"] - 1):
          ret.update(self.runNoiseTests(params))
          print("Noise test results: totalCorrect=", ret["totalCorrect"],
                "Test error=", ret["testerror"], ", entropy=", ret["entropy"])
          if ret["totalCorrect"] > 100000 and ret["testerror"] > 98.3:
            print("*******")
            print(params)
  
        ret.update({"elapsedTime": time.time() - self.startTime})
        ret.update({"learningRate": self.learningRate if self.lr_scheduler is None
                                                      else self.lr_scheduler.get_lr()})
  
        print("Iteration time= {0:.3f} secs, "
              "total elapsed time= {1:.3f} mins".format(
                time.time() - t1,ret["elapsedTime"]/60.0))
  
      except Exception as e:
        # Tracebacks are not printed if using multiprocessing so we do it here
        tb = sys.exc_info()[2]
        traceback.print_tb(tb)
        raise RuntimeError("Something went wrong in iterate", e)
  
      return ret
docs: Called once for each training iteration (== epoch here).