Skip to content

Commit 36da6db

Browse files
committed
Improve warning msg
1 parent c285b36 commit 36da6db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

torch/nn/parallel/_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ def forward(ctx, target_device, dim, *inputs):
5555
ctx.input_gpus = tuple(map(lambda i: i.get_device(), inputs))
5656
if all(t.dim() == 0 for t in inputs) and dim == 0:
5757
inputs = tuple(t.view(1) for t in inputs)
58-
warnings.warn('When gathering along dimension 0, all input tensors '
59-
'are scalars, will unsqueeze and return a vector instead.')
58+
warnings.warn('Was asked to gather along dimension 0, but all '
59+
'input tensors were scalars; will instead unsqueeze '
60+
'and return a vector.')
6061
ctx.unsqueezed_scalar = True
6162
else:
6263
ctx.unsqueezed_scalar = False

0 commit comments

Comments
 (0)