I’m not sure how log actually stores trn_loss and val_loss, but you might want to do trn_loss.detach().item() and val_loss.detach().item() here instead to avoid keeping tensors that aren’t needed anymore around.