Skip to content

Commit 2d5a7f5

Browse files
Fixes #3276 (#4116)
1 parent eef1b5d commit 2d5a7f5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pytorch_lightning/core/step_result.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ def reduce_across_time(cls, time_outputs):
476476
else:
477477
tbptt_reduce_fx = meta[k]['tbptt_reduce_fx']
478478

479+
if isinstance(value, list):
480+
value = torch.tensor(value)
481+
479482
if isinstance(value, dict):
480483
# TODO: recursive reduce:
481484
_recursive_fx_apply(value, tbptt_reduce_fx)

tests/trainer/logging/test_eval_loop_logging_1_0.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def training_step(self, batch, batch_idx):
2121
acc = self.step(batch, batch_idx)
2222
acc = acc + batch_idx
2323
self.log('a', acc, on_step=True, on_epoch=True)
24+
self.log('a2', 2)
25+
2426
self.training_step_called = True
2527
return acc
2628

@@ -50,6 +52,7 @@ def backward(self, loss, optimizer, optimizer_idx):
5052
# make sure all the metrics are available for callbacks
5153
expected_logged_metrics = {
5254
'a',
55+
'a2',
5356
'a_step',
5457
'a_epoch',
5558
'b',
@@ -65,7 +68,7 @@ def backward(self, loss, optimizer, optimizer_idx):
6568
# on purpose DO NOT allow step_b... it's silly to monitor val step metrics
6669
callback_metrics = set(trainer.callback_metrics.keys())
6770
callback_metrics.remove('debug_epoch')
68-
expected_cb_metrics = {'a', 'b', 'a_epoch', 'b_epoch', 'a_step'}
71+
expected_cb_metrics = {'a', 'a2', 'b', 'a_epoch', 'b_epoch', 'a_step'}
6972
assert expected_cb_metrics == callback_metrics
7073

7174

0 commit comments

Comments
 (0)