torch.sparse.spdiags
torch.sparse.spdiags(diagonals, offsets, shape, layout=None) -> Tensor
Creates a sparse 2D tensor by placing the values from rows of
   "diagonals" along specified diagonals of the output
The "offsets" tensor controls which diagonals are set.


If "offsets[i]" = 0, it is the main diagonal


If "offsets[i]" < 0, it is below the main diagonal


If "offsets[i]" > 0, it is above the main diagonal


The number of rows in "diagonals" must match the length of
   "offsets", and an offset may not be repeated.
Parameters:
      * diagonals (Tensor) -- Matrix storing diagonals row-wise
  * **offsets** (*Tensor*) -- The diagonals to be set, stored as a
    vector

  * **shape** (*2-tuple of ints*) -- The desired shape of the
    result

Keyword Arguments:
      layout ("torch.layout", optional) -- The desired layout of
      the returned tensor. "torch.sparse_coo", "torch.sparse_csc" and