-
Notifications
You must be signed in to change notification settings - Fork 22
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
using rowvar keyword in dpnp.cov #1371
Conversation
eb6c4b5
to
11d596f
Compare
16240a1
to
bdd40da
Compare
bdd40da
to
7b3b992
Compare
7b3b992
to
5d837b1
Compare
5d837b1
to
4e04716
Compare
if not rowvar and x1.shape[0] != 1: | ||
x1 = x1.get_array() if isinstance(x1, dpnp_array) else x1 | ||
x1 = dpnp_array._create_from_usm_ndarray(x1.mT) | ||
x1 = dpnp.astype(x1, dpnp.float64) if x1_desc.dtype != dpnp.float64 else x1 |
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.
Please test that this works on Iris Xe, or other devices that do not support float64
data type.
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.
It will not work. @antonwolfy mentioned it is written like this because Numpy by default returns float64
for any input data type. The suggestion was to fix it in a separate ticket since it needs to correct dpnp c++ backend code.
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.
I've filed #1379 to add support of dpnp.cov
on Iris Xe
x1 = dpnp.astype(x1, dpnp.float64) if x1_desc.dtype != dpnp.float64 else x1 | ||
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) | ||
elif x1_desc.dtype != dpnp.float64: | ||
x1 = dpnp.astype(x1, dpnp.float64) |
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.
Same comment here
4e04716
to
93bb5e7
Compare
93bb5e7
to
d7c3dc8
Compare
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! thank you @vtavana !
Closes #1367
rowvar
keyword is added todpnp.cov
functiondpnp.dpnp_array.dpnp_array._create_from_usm_ndarray(x.get_array().mT)
is used since it is faster thandpnp.transpose(x)
since dpnp.tarnsport%timeit dpnp.cov(dpnp.dpnp_array.dpnp_array._create_from_usm_ndarray(x.get_array().mT))
5.4 ms ± 121 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit dpnp.cov(dpnp.transpose(x))
9.46 ms ± 455 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit dpnp.cov(x, rowvar=False)
5.49 ms ± 352 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)