!16689 update docs of SparseToDense in for it lack some infomation

From: @dinglinhe123
Reviewed-by: @liangchenghui,@wuxuejian
Signed-off-by: @liangchenghui
This commit is contained in:
mindspore-ci-bot 2021-05-29 14:35:09 +08:00 committed by Gitee
commit 27d0973f57
1 changed files with 8 additions and 4 deletions

View File

@ -19,16 +19,21 @@ from ..cell import Cell
class SparseToDense(Cell): class SparseToDense(Cell):
""" """
Convert a sparse tensor into dense. Converts a sparse representation into a dense tensor.
Not yet supported by any backend at the moment. Not yet supported by any backend at the moment.
Args: Inputs:
sparse_tensor (SparseTensor): the sparse tensor to convert. sparse_tensor (SparseTensor): the sparse tensor to convert.
Returns: Outputs:
Tensor, the tensor converted. Tensor, the tensor converted.
Raises:
TypeError: If `sparse_tensor.indices` is neither int32 nor int64.
TypeError: If 'sparse_tensor.values' is not a Number.
TypeError: If 'sparse_tensor.dense_shape' is not a tuple.
Supported Platforms: Supported Platforms:
``CPU`` ``CPU``
@ -36,7 +41,6 @@ class SparseToDense(Cell):
>>> import mindspore as ms >>> import mindspore as ms
>>> from mindspore import Tensor, SparseTensor >>> from mindspore import Tensor, SparseTensor
>>> import mindspore.nn as nn >>> import mindspore.nn as nn
>>> indices = Tensor([[0, 1], [1, 2]]) >>> indices = Tensor([[0, 1], [1, 2]])
>>> values = Tensor([1, 2], dtype=ms.int32) >>> values = Tensor([1, 2], dtype=ms.int32)
>>> dense_shape = (3, 4) >>> dense_shape = (3, 4)