def train(self, start_epoch, max_epoch):
    'Generic training loops.'
    self.start_epoch = start_epoch
    self.max_epoch = max_epoch
    self.before_train()
    for self.epoch in range(self.start_epoch, self.max_epoch):
        self.before_epoch()
        self.run_epoch()
        self.after_epoch()
    self.after_train()
Generic training loops.
def train(self, start_epoch, max_epoch):
    
    self.start_epoch = start_epoch
    self.max_epoch = max_epoch
    self.before_train()
    for self.epoch in range(self.start_epoch, self.max_epoch):
        self.before_epoch()
        self.run_epoch()
        self.after_epoch()
    self.after_train()