!40310 fix tensor api

Merge pull request !40310 from lianliguang/code_docs_ms
This commit is contained in:
i-robot 2022-08-17 07:45:51 +00:00 committed by Gitee
commit ea865d8eb7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 3 deletions

View File

@ -4,7 +4,9 @@ mindspore.Tensor.from_numpy
.. py:method:: mindspore.Tensor.from_numpy(array)
:staticmethod:
通过不复制数据的方式将Numpy数组转换为张量。
将Numpy数组转换为张量。
当数据为非C连续时数据会被拷贝成C连续数据后创建张量否则则通过不复制数据的方式将Numpy数组转换为张量。
参数:
- **array** (numpy.array) - 输入数组。

View File

@ -418,8 +418,9 @@ class Tensor(Tensor_):
@staticmethod
def from_numpy(array):
"""
Convert numpy array to Tensor without copy data.
Convert numpy array to Tensor.
If the data is not C contiguous, the data will be copied to C contiguous to construct the tensor.
Otherwise, The tensor will be constructed using this numpy array without copy.
Args:
array (numpy.array): The input array.