    def step(self, epoch, val_loss=None):
        """
        Update the learning rate at the end of the given epoch if warmup
        finishes otherwise no update of lr on epoch boundaries
        """
        if val_loss is not None and self.warmup_end is True:
            self.lr_scheduler.step(val_loss)
        else:
            self.lr_scheduler.last_epoch = epoch
        return self.optimizer.get_lr()
Update the learning rate at the end of the given epoch if warmup
finishes otherwise no update of lr on epoch boundaries
fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py