Skip to content

Commit 622dd23

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Add error message when setting 1D tensor ToImage() (#9114)
Summary: Co-authored-by: Nicolas Hug <[email protected]> Reviewed By: AntoineSimoulin Differential Revision: D79175021 fbshipit-source-id: a4345beae9801f31b30f6394452f07adf7bcf4fb
1 parent db386ac commit 622dd23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/tv_tensors/_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __new__(
4343

4444
tensor = cls._to_tensor(data, dtype=dtype, device=device, requires_grad=requires_grad)
4545
if tensor.ndim < 2:
46-
raise ValueError
46+
raise ValueError(f"Tensor must be 2D or higher, got {tensor.ndim}D tensor.")
4747
elif tensor.ndim == 2:
4848
tensor = tensor.unsqueeze(0)
4949

0 commit comments

Comments
 (0)