-
Notifications
You must be signed in to change notification settings - Fork 30
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
Enable support for Python operators in usm_ndarray class #1324
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1324/index.html |
usm_ndarray constructor's array_namespace argument's default value of None is now interpreted to mean that usm_ndarray.__array_namespace__ returns dpctl.tensor, rather than None. This directly affects how Python operator special methods of usm_ndarray behave. They would now look up corresponding attribute in dpctl.tensor namespace.
75cd2da
to
78aa99b
Compare
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_89 ran successfully. |
``` In [1]: dpctl.tensor._usmarray as ua ua._basic_slice_meta((0, slice(1, 0, None)), (4, 4), (4, 1), 0) ``` The issue was discovered by array API conformance tests.
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_90 ran successfully. |
``` import dpctl.tensor as dpt x = dpt.empy((0,2), dtype='i4') x[Ellipsis, 1] returns empty 1d array ```
- "power" corrected to "pow, "mod" corrected to "remainder" - logical functions corrected to bitwise
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_91 ran successfully. |
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_95 ran successfully. |
``` import dpctl.tensor as dpt import dpctl.tensor._usmarray as ua x = dpt.asarray([[0, 0], [1, 0]], dtype='int8') key = (None, 0, slice(1, None, -1)) meta = ua._basic_slice_meta(key, x.shape, x.strides, x._element_offset) y = dpt.usm_ndarray.__new__(dpt.usm_ndarray, meta[0], dtype=x.dtype, strides=meta[1], buffer=x.usm_data, offset=meta[2]) print(y.flags) ``` Both 'C' and 'F' flags of the created array used to be set, now both are correctly unset.
- Incorrect test logic was being hidden by the bug
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_97 ran successfully. |
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_100 ran successfully. |
Array API tests pointed out an error in implementation of order='K' in dpctl.tensor.astype. Moved _empty_like_orderK and fried from _type_utils to _copy_utils and used it to implement astype. Modified import statement in _elementwise_common where _empty_like* are used.
fd54583
to
3ddf51c
Compare
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_102 ran successfully. |
1 similar comment
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_102 ran successfully. |
The dpctl/tests/test_type_utils.py has been removed.
``` import dpctl.tensor as dpt x1 = dpt.full(tuple(), 77, dtype='u2') x2 = dpt.zeros(2, dtype='uint8')[dpt.newaxis, :] dpt.concat((x1, x2), axis=None) ``` The reason the exception was raised is that _copy_usm_ndarray_for_reshape which is used in the implementation of concat with axis=None requires both source and destination to have the same data-type.
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_106 ran successfully. |
If both arguments are -inf, the result is also -inf.
The change is to suppress RuntimeWarning arising from within assert_allclose utility.
Use `self.flags_` directly, instead of getting it via temporary Flags object.
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_118 ran successfully. |
739475d
to
9a34d76
Compare
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
9a34d76
to
15fa52c
Compare
dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp
Outdated
Show resolved
Hide resolved
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_119 ran successfully. |
15fa52c
to
ebd1faf
Compare
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_120 ran successfully. |
1 similar comment
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_120 ran successfully. |
Given that this PR has grown big, I am inclined to get it merged while deferring further changes to new PRs. Would like a feedback from |
All |
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.
If you won't be adding more changes and dpnp has no issues, then this PR LGTM @oleksandr-pavlyk .
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.14.6dev1=py310h7bf5fec_29 ran successfully. |
This PR has the effect of unlocking use of
dpctl.tensor
elementwise functions to power special methods inusm_ndarray
class.