nnz在以下pytorch函数的输出中是什么意思
torch.sparse_coo_tensor(索引,值,大小=无,dtype =无,设备=无,requires_grad = False)
可以在此链接https://pytorch.org/docs/stable/torch.html
中找到
i = torch.tensor([[0, 1, 1],
[2, 0, 2]])
v = torch.tensor([3, 4, 5], dtype=torch.float32)
torch.sparse_coo_tensor(i, v, [2, 4],
dtype=torch.float64,
device=torch.device('cuda:0'))
tensor(indices=tensor([[0, 1, 1],
[2, 0, 2]]),
values=tensor([3., 4., 5.]),
device='cuda:0', size=(2, 4), nnz=3, dtype=torch.float64,
layout=torch.sparse_coo)
答案 0 :(得分:1)