-
Notifications
You must be signed in to change notification settings - Fork 55
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
Improve error message with mismatched valtype/dtype #2739
Conversation
We already check types when binding arguments, but now we explicitly state which arguments mismatch, and in which positions. Fixes #2670 by improving the error message. Before this change the error message was ``` RuntimeError: Expected T0_g[ iS0{i1} ] to be bound to an at::Tensor, but got l ``` After this PR, the error is ``` Mismatch in input type: argument 0 (T0_g[ iS0{i0} ]) should be a float tensor but double scalar 2 was provided. ```
!build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That error message is a great improvement! Thank you.
This is not an ideal fix since it replicates (poorly) the validation that already exists in for (const auto i : c10::irange(inputs.size())) {
ErrorContext e("Error binding input " + std::to_string(i));
expr_eval.bind(inputs[i], *args[i], true);
} Then if |
I fixed this up by determining the input position inside the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-+1'ing the new changes.
But I also want to plug #1758: I'd really encourage an up-front pass to validate as soon as we can. As we found with latency work (#2136), ExprEvaluator is on the critical path, and so I worry about adding more checks in there.
Admittedly--these checks have to be on the critical path (since we can only validate when we see what inputs we actually receive). But it would probably behoove us to do an up-front check for UX purposes and avoid checks inside each Expr evaluation.
We already check types when binding arguments, but now we explicitly state which arguments mismatch, and in which positions.
Fixes #2670 by improving the error message. Before this change the error message was
After this PR, the error is