def doOneEpoch(self, nr_epoch, episodes):
    mode = ('train' if self.training else 'val')
    data_generator = generate_batch(episodes, self.batch_size, self.device)
    for (steps, batch) in enumerate(data_generator):
        print(f'batch nr {steps} for mode {mode}')
        loss = self(batch)
        self.opt.zero_grad()
        loss.backward()
        self.opt.step()
        self.update_moving_average()
    self.logResults(nr_epoch, (loss / steps), prefix=mode)
    if (mode == 'val'):
        self.early_stopper(((- loss) / steps), self.online_encoder)
def doOneEpoch(self, nr_epoch, episodes):
    mode = ('train' if self.training else 'val')
    data_generator = generate_batch(episodes, self.batch_size, self.device)
    for (steps, batch) in enumerate(data_generator):
        print(f'batch nr {steps} for mode {mode}')
        loss = self(batch)
        self.opt.zero_grad()
        loss.backward()
        self.opt.step()
        self.update_moving_average()
    self.logResults(nr_epoch, (loss / steps), prefix=mode)
    if (mode == 'val'):
        self.early_stopper(((- loss) / steps), self.online_encoder)