diff --git a/RELEASE.md b/RELEASE.md index 194aef55c51..49e57cd32b9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -24,6 +24,119 @@ The FusedBatchNorm and FusedBatchNormEx interface has been deleted. Please use t The MetaTensor interface has been deleted. The function of MetaTensor has been integrated into tensor. +###### `mindspore.numpy.array()`, `mindspore.numpy.asarray()`, `mindspore.numpy.asfarray()`, `mindspore.numpy.copy()` now support GRAPH mode, but cannot accept `numpy.ndarray` as input arguments anymore([!12726](https://gitee.com/mindspore/mindspore/pulls/12726)) + +Previously, these interfaces can accept numpy.ndarray as arguments and convert numpy.ndarray to Tensor, but cannot be used in GRAPH mode. +However, currently MindSpore Parser cannot parse numpy.ndarray in JIT-graph. To support these interfaces in graph mode, we have to remove `numpy.ndarray` support. With that being said, users can still use `Tensor` to convert `numpy.ndarray` to tensors. + +
1.1.0 | 1.2.0 | +
+ +```python +>>> import mindspore.numpy as mnp +>>> import numpy +>>> +>>> nd_array = numpy.array([1,2,3]) +>>> tensor = mnp.asarray(nd_array) # this line cannot be parsed in GRAPH mode +``` + + | ++ +```python +>>> import mindspore.numpy as mnp +>>> import numpy +>>> +>>> tensor = mnp.asarray([1,2,3]) # this line can be parsed in GRAPH mode +``` + + | +
1.1.0 | 1.2.0 | +
+ +```python +>>> import mindspore.numpy as np +>>> +>>> a = np.ones((3,3)) +>>> b = np.ones((3,3)) +>>> out = np.zeros((3,3)) +>>> where = np.asarray([[True, False, True],[False, False, True],[True, True, True]]) +>>> res = np.add(a, b, out=out, where=where) # `out` cannot be used as a reference, therefore it is misleading +``` + + | ++ +```python +>>> import mindspore.numpy as np +>>> +>>> a = np.ones((3,3)) +>>> b = np.ones((3,3)) +>>> out = np.zeros((3,3)) +>>> where = np.asarray([[True, False, True],[False, False, True],[True, True, True]]) +>>> res = np.add(a, b) +>>> out = np.where(where, x=res, y=out) # instead of np.add(a, b, out=out, where=where) +``` + + | +
1.1.0 | 1.2.0 | +
+ +```python +>>> import numpy as np +>>> from mindspore import Tensor, nn +>>> +>>> x = Tensor(np.ones((2, 3)).astype(onp.float32) +>>> y = Tensor(np.ones((3, 4)).astype(onp.float32) +>>> nn.MatMul()(x, y) +``` + + | ++ +```python +>>> import numpy as np +>>> from mindspore import Tensor, ops +>>> +>>> x = Tensor(np.ones((2, 3)).astype(onp.float32) +>>> y = Tensor(np.ones((3, 4)).astype(onp.float32) +>>> ops.matmul(x, y) +``` + + | +