!37462 fix csr_to_coo code docs

Merge pull request !37462 from huangmengxi/code_docs_csr
This commit is contained in:
i-robot 2022-07-07 08:01:50 +00:00 committed by Gitee
commit e58b4894ff
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 6 deletions

View File

@ -428,6 +428,7 @@ Array操作
mindspore.ops.dense_to_sparse_coo
mindspore.ops.dense_to_sparse_csr
mindspore.ops.csr_to_coo
Parameter操作算子
--------------------

View File

@ -130,12 +130,12 @@ def csr_to_coo(tensor):
``GPU``
Examples:
>>> from mindspore import Tensor, COOTensor
>>> import mindspore as ms
>>> indices = Tensor([[0, 1], [1, 2]], dtype=ms.int32)
>>> values = Tensor([1, 2], dtype=ms.float32)
>>> shape = (3, 4)
>>> x = COOTensor(indices, values, shape)
>>> from mindspore import Tensor, CSRTensor
>>> indptr = Tensor([0, 1, 2]).astype("int32")
>>> indices = Tensor([0, 1]).astype("int32")
>>> values = Tensor([2, 1]).astype("float32")
>>> shape = (2, 4)
>>> x = CSRTensor(indptr, indices, values, shape)
>>> output = ops.csr_to_coo(x)
>>> print(output)
"""