Returns a copy in dense matrix format of the sparse matrix. Returns ------- torch.Tensor The copy in dense matrix format
(self)
| 201 | return self.c_sparse_matrix.csc() |
| 202 | |
| 203 | def to_dense(self) -> torch.Tensor: |
| 204 | """Returns a copy in dense matrix format of the sparse matrix. |
| 205 | |
| 206 | Returns |
| 207 | ------- |
| 208 | torch.Tensor |
| 209 | The copy in dense matrix format |
| 210 | """ |
| 211 | row, col = self.coo() |
| 212 | val = self.val |
| 213 | shape = self.shape + val.shape[1:] |
| 214 | mat = torch.zeros(shape, device=self.device, dtype=self.dtype) |
| 215 | mat[row, col] = val |
| 216 | return mat |
| 217 | |
| 218 | def t(self): |
| 219 | """Alias of :meth:`transpose()`""" |