mindspore.ops.SparseToDense¶
-
class
mindspore.ops.
SparseToDense
(*args, **kwargs)[source]¶ Converts a sparse representation into a dense tensor.
- Inputs:
indices (Tensor) - The indices of sparse representation.
values (Tensor) - Values corresponding to each row of indices.
dense_shape (tuple) - An int tuple which specifies the shape of dense tensor.
- Returns
Tensor, the shape of tensor is dense_shape.
Examples
>>> indices = Tensor([[0, 1], [1, 2]]) >>> values = Tensor([1, 2], dtype=ms.float32) >>> dense_shape = (3, 4) >>> out = ops.SparseToDense()(indices, values, dense_shape)