mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix error message of autograd (#123154)
This PR updates the error message in autograd when an input tensor does not set to `require_grad`. The original message does not contain the index info, making users hard to debug. The error message style consists with that on line 105-109. Co-authored-by: Jeffrey Wan <soulitzer@gmail.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/123154 Approved by: https://github.com/soulitzer
This commit is contained in:
committed by
PyTorch MergeBot
parent
700917c361
commit
691054eeef
@ -1661,7 +1661,7 @@ TEST(TestAutogradNotImplementedFallback, TensorlistOp) {
|
||||
|
||||
ASSERT_THROWS_WITH(
|
||||
torch::autograd::grad({out}, {vec[0]}),
|
||||
"One of the differentiated Tensors does not require grad");
|
||||
"element 0 of the input tensors does not require grad");
|
||||
ASSERT_THROWS_WITH(
|
||||
torch::autograd::grad({out}, {vec[1]}), "is not implemented");
|
||||
|
||||
|
Reference in New Issue
Block a user