spyrit.core.torch.spdiags

spyrit.core.torch.spdiags(diagonals, offsets, shape)[source]
Similar to torch.sparse.spdiags. Arguments are the same, excepted :
  • diagonals is a list of 1D tensors (does not need to be a tensor)

  • offsets is a list of integers (does not need to be a tensor)

  • shape is unchanged (a tuple)

Most notably:
  • Using a positive offset, the first element of the matrix diagonal

is the first element of the provided diagonal. torch.sparse.spdiags introduces an offset of k when using a positive offset k.