新昌推行机关党建标准化:30项工作规范让党建“看得见、摸得着、有实效”

paddle.Tensor. to_dense ( self: Tensor ) Tensor
Notes:
百度 在改善民生方面,要正视政策驱动的城镇化对草原生态环境的不利影响,把草原治理与社会治理结合起来,强化对生态系统的综合管理。

This API is ONLY available in Dygraph mode

Convert the current SparseTensor(COO or CSR) to DenseTensor.

Returns

A DenseTensor

Return type

Tensor

Examples

>>> import paddle
>>> indices = [[0, 0, 1, 2, 2], [1, 3, 2, 0, 1]]
>>> values = [1, 2, 3, 4, 5]
>>> dense_shape = [3, 4]
>>> sparse_x = paddle.sparse.sparse_coo_tensor(paddle.to_tensor(indices, dtype='int64'), paddle.to_tensor(values, dtype='float32'), shape=dense_shape)
>>> dense_x = sparse_x.to_dense()
>>> print(dense_x)
Tensor(shape=[3, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0., 1., 0., 2.],
 [0., 0., 3., 0.],
 [4., 5., 0., 0.]])