Skip to content

Commit 5b7e4e1

Browse files
committed
fix outputs issue
1 parent aa8fe5d commit 5b7e4e1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pytorch_lightning/trainer/evaluation_loop.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,6 @@ def __run_eval_epoch_end(self, num_dataloaders):
204204
# with a single dataloader don't pass an array
205205
outputs = self.outputs
206206

207-
# free memory
208-
self.outputs = []
209-
210207
eval_results = outputs
211208
if num_dataloaders == 1:
212209
eval_results = outputs[0]
@@ -321,6 +318,10 @@ def on_evaluation_epoch_end(self, *args, **kwargs):
321318

322319
def call_on_evaluation_epoch_end_hook(self):
323320
outputs = self.outputs
321+
322+
# free memory
323+
self.outputs = []
324+
324325
model_ref = self.trainer.lightning_module
325326
hook_name = "on_test_epoch_end" if self.trainer.testing else "on_validation_epoch_end"
326327

0 commit comments

Comments
 (0)