avg_epoch_loss = np.mean(epoch_losses) self.train_losses.append(avg_epoch_loss)