-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[numpy] fix mix numpy scalar and MXNet numpy ndarray #18313
Conversation
Hey @BenjaminCHEN2016 , Thanks for submitting the PR
CI supported jobs: [windows-gpu, centos-cpu, unix-cpu, website, windows-cpu, miscellaneous, centos-gpu, sanity, edge, clang, unix-gpu] Note: |
96b2362
to
5235944
Compare
@yzhliu @sxjscience Any thoughts on the conversion rules? |
9a309cb
to
2356ee0
Compare
import jax.numpy as jnp
import numpy as onp
# jnp += onp
a = jnp.ones((10,))
b = onp.ones((10,))
a += b
print(type(a))
# onp += jnp
a = onp.ones((10,))
b = jnp.ones((10,))
a += b
print(type(a)) Output:
|
In Jax, if any ndarray is a Jax ndarray, the result will also be a Jax ndarray. |
Jax does not implement inplace op overload like |
I agree with that. |
Conversion rules:
|
Undefined action detected. |
1 similar comment
Undefined action detected. |
@mxnet-bot run ci [miscellaneous, unix-cpu] |
Jenkins CI successfully triggered : [miscellaneous, unix-cpu] |
@mxnet-bot run ci [windows-cpu, windows-gpu, centos-cpu] |
Jenkins CI successfully triggered : [centos-cpu, windows-gpu, windows-cpu] |
LGTM now. @yzhliu |
@mxnet-bot run ci [centos-cpu] |
Jenkins CI successfully triggered : [centos-cpu] |
@mxnet-bot run ci [unix-gpu] |
Jenkins CI successfully triggered : [unix-gpu] |
@mxnet-bot run ci [unix-gpu] |
Jenkins CI successfully triggered : [unix-gpu] |
@sxjscience Any thoughts on this pr? |
Description
Attempt to resolve issue mentioned in #16743
It is done by casting the inputs into mx_np or np.
Current conversion rules:
a += b
a += b
c = a + b
c = a + b
However, the example code in the issue still can't run due to type issue.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments