API symbolssparse
Copy
tensorplay.sparse.spdiags
- tensorplay.sparse.spdiags(diagonals, offsets, shape, layout=None)[source]
Constructs a sparse tensor from diagonals, mirroring
torch.sparse.spdiags(and therebyscipy.sparse.spdiags).- Parameters:
diagonals – matrix of shape
(len(offsets), L)(or a single vector); rowjholds the values of diagonaloffsets[j], read starting at columnmax(offset, 0).offsets – int64 sequence of distinct diagonal offsets (0 = main, positive = above, negative = below).
shape – 2-element
(M, N)output size.layout – output layout tag —
tensorplay.sparse_coo(default) ortensorplay.sparse_csr.
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?
