-
Notifications
You must be signed in to change notification settings - Fork 30
Improve dpctl.tensor.full
error for invalid fill_value
#1878
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 dpctl.tensor.full
error for invalid fill_value
#1878
Conversation
…type pybind11 raises RuntimeError when a value cannot be cast to a type, i.e., a string to an integer. Now when scalar is not an array, a check is performed, and TypeError is raised
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.
LGTM!
48faeac
to
748fde5
Compare
I've added this change to the changelog as well. |
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_150 ran successfully. |
Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_151 ran successfully. |
NumPy bools do not subclass `numbers.Number` and therefore must be handled separately. Python bools do, so no logic is needed.
Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_152 ran successfully. |
Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_158 ran successfully. |
This PR proposes adding a check to
full
when the value to construct the array with is not a scalar value, i.e., some type of object or a string.Previously these cases would fail, but pybind11 would throw RuntimeError. Now, a TypeError is thrown from Python, and the result array is never allocated, preventing wasted memory allocation.