to_sparse_coo
- paddle.Tensor. to_sparse_coo ( self: Tensor, sparse_dim: int ) Tensor
- 
         - Notes:
- 
           This API is ONLY available in Dygraph mode 
 Convert the current DenseTensor to SparseTensor in COO format. - Returns
- 
           A SparseCooTensor 
- Return type
- 
           Tensor 
 Examples >>> import paddle >>> dense_x = [[0, 1, 0, 2], [0, 0, 3, 4]] >>> dense_x = paddle.to_tensor(dense_x, dtype='float32') >>> sparse_x = dense_x.to_sparse_coo(sparse_dim=2) >>> print(sparse_x) Tensor(shape=[2, 4], dtype=paddle.float32, place=Place(cpu), stop_gradient=True, indices=[[0, 0, 1, 1], [1, 3, 2, 3]], values=[1., 2., 3., 4.]) 
