-
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
Reshape improvements #1677
Reshape improvements #1677
Conversation
Closes gh-1664 If copy is not required, and requested shape is the same as the shape of the array, return the array itself.
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_355 ran successfully. |
53 tests affecting call of The first issue I've found is incorrect result returned below: import dpnp
from dpnp.dpnp_utils.dpnp_utils_linearalgebra import _define_contig_flag
a = dpnp.arange(3).reshape((1, 3, 1))
_define_contig_flag(a)
# Out: False but it's expected to return The second one is somewhere in import dpctl, dpctl.tensor as dpt
import dpnp.backend.extensions.blas._blas_impl as bi
a = dpt.reshape(dpt.arange(60, dtype='f4'), (5, 4, 3))
b = dpt.reshape(dpt.arange(3, dtype='f4'), (1, 3, 1))
b = dpt.copy(b)
c = dpt.zeros((5, 4, 1))
a.strides, b.strides, c.strides
# Out: ((12, 3, 1), (3, 1, 1), (4, 1, 1))
ev, _, _ = bi._gemm_batch(a.sycl_queue, a, b, c)
ev.wait()
c
# Out:
# usm_ndarray([[[ 5.],
# [14.],
# [23.],
# [32.]],
#
# [[ 0.],
# [ 0.],
# [ 0.],
# [ 0.]],
#
# [[ 0.],
# [ 0.],
# [ 0.],
# [ 0.]],
#
# [[ 0.],
# [ 0.],
# [ 0.],
# [ 0.]],
#
# [[ 0.],
# [ 0.],
# [ 0.],
# [ 0.]]], dtype=float32) @vtavana , could you please look on that? |
The necessary changes are implemented in dpnp-gh-1828. Relevant tests in |
First case is working correctly in dpctl
@vtavana does dpnp-gh-1828 address this case too? |
Yes, both examples provided by @antonwolfy also work fine in dpnp-gh-1828. As a side note, |
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.
Tested this out, this LGTM!
Closes gh-1664.
Improves performance of
dpt.reshape(X, new_shape, order="F")
when copy is needed.