Rate this Page

torch.Tensor.to_sparse_coo#

Tensor.to_sparse_coo()[source]#

Convert a tensor tocoordinate format.

Examples:

>>>dense=torch.randn(5,5)>>>sparse=dense.to_sparse_coo()>>>sparse._nnz()25