diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index e88750ad25..6b8ed1ea65 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -1156,6 +1156,10 @@ class Trainer(TrainerIO): except Exception: if type(output) is torch.Tensor: loss = output + else: + raise RuntimeError( + 'No `loss` value in the dictionary returned from `model.training_step()`.' + ) # when using dp need to reduce the loss if self.use_dp: