-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[BE] Raise better exception in torch.[con]cat[enate]
#155460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/155460
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 6 Pending, 2 Unrelated FailuresAs of commit 773e9f9 with merge base 79aef14 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
By replacing `TORCH_CHECK` with `TORCH_CHECK_VALUE` Also make redispatching from aliases an even simpler, by just calling respective original class Addresses feedback raised in https://github.com/pytorch/pytorch/pull/155383/files#r2133952368 ghstack-source-id: 9b571d4 Pull Request resolved: #155460
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 2 checks: pull / linux-jammy-py3-clang12-executorch / test (executorch, 1, 1, linux.2xlarge, unstable), pull / cuda12.8-py3.10-gcc9-sm75 / test (pr_time_benchmarks, 1, 1, linux.g4dn.metal.nvidia.gpu) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
@pytorchbot merge -f "This seems fine" |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
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 |
|
@malfet FYI I'm working on a BC-breaking note for this PR and realized that the change only affects the dimname overload of cat() / concatenate(). Was this intentional? |
|
@jbschlosser Thank you for flagging, looks like it's not really a BC breaking, as in 2.7 the call to torch.cat with empty tensor crashed, but in 2.8 it'll return value error. vs |
so there's a divergence now wrt error type between dimname and non-dimname overloads |
ah okay, sounds good! thanks for clarifying |
Followup after #155460 From [Python documentation](https://docs.python.org/3/library/exceptions.html#ValueError): > Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
Followup after #155460 From [Python documentation](https://docs.python.org/3/library/exceptions.html#ValueError): > Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
Followup after #155460 From [Python documentation](https://docs.python.org/3/library/exceptions.html#ValueError): > Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError. Raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) when input-output types are incompatible with each other > Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch. > This exception may be raised by user code to indicate that an attempted operation on an object is not supported, and is not meant to be. If an object is meant to support a given operation but has not yet provided an implementation, [NotImplementedError](https://docs.python.org/3/library/exceptions.html#NotImplementedError) is the proper exception to raise. Pull Request resolved: #158249 Approved by: https://github.com/jbschlosser, https://github.com/Skylion007, https://github.com/albanD
Stack from ghstack (oldest at bottom):
torch.[con]cat[enate]#155460By replacing
TORCH_CHECKwithTORCH_CHECK_VALUEAlso make redispatching from aliases an even simpler, by just calling
respective original class
Addresses feedback raised in https://github.com/pytorch/pytorch/pull/155383/files#r2133952368
cc @albanD