Add checks for empty tensor list#155383
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/155383
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 6fe8e6a with merge base 7e4c097 ( UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Can you confirm from the transcript that the tests fail before the change? |
|
Also the diff is kind of suspicious, all the places annotated with checks call functions I would also expect to do the non empty check |
Yes, run
It crashes inside |
|
|
||
| // torch.concat, alias for torch.cat | ||
| Tensor& concat_out(TensorList tensors, Dimname dim, Tensor& result) { | ||
| TORCH_CHECK(!tensors.empty(), "expected a non-empty list of Tensors"); |
There was a problem hiding this comment.
| TORCH_CHECK(!tensors.empty(), "expected a non-empty list of Tensors"); | |
| TORCH_CHECK_VALUE(!tensors.empty(), "expected a non-empty list of Tensors"); |
These should all be ValueErrors
ezyang
left a comment
There was a problem hiding this comment.
I misunderstood the change, current location is good.
|
@pytorchbot merge -f "Lint is green" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Vibe-coded with Codex, after collecting a backtrace, see https://chatgpt.com/s/cd_68438be8a1248191adbfa0a5f000e60b
Even though, check for empty tensor list exists in
at::catcrash might happens while resolving named dimension to position, by callingdimname_to_position(tensors[0], dim), see backtrace belowTODOs:
test_tensor_creation.pyto OpInfo (not sure which one is more readable)TORCH_CHECKwithTORCH_CHECK_VALUEand adjust unit testsFixes #155306