MCPcopy Index your code
hub / github.com/dmlc/dgl / transpose

Method transpose

python/dgl/sparse/sparse_matrix.py:227–247  ·  view source on GitHub ↗

Returns the transpose of this sparse matrix. Returns ------- SparseMatrix The transpose of this sparse matrix. Examples -------- >>> indices = torch.tensor([[1, 1, 3], [2, 1, 3]]) >>> val = torch.tensor([1, 1, 2]) >>> A =

(self)

Source from the content-addressed store, hash-verified

225 return self.transpose()
226
227 def transpose(self):
228 """Returns the transpose of this sparse matrix.
229
230 Returns
231 -------
232 SparseMatrix
233 The transpose of this sparse matrix.
234
235 Examples
236 --------
237
238 >>> indices = torch.tensor([[1, 1, 3], [2, 1, 3]])
239 >>> val = torch.tensor([1, 1, 2])
240 >>> A = dglsp.spmatrix(indices, val)
241 >>> A = A.transpose()
242 SparseMatrix(indices=tensor([[2, 1, 3],
243 [1, 1, 3]]),
244 values=tensor([1, 1, 2]),
245 shape=(4, 4), nnz=3)
246 """
247 return SparseMatrix(self.c_sparse_matrix.transpose())
248
249 def to(self, device=None, dtype=None):
250 """Performs matrix dtype and/or device conversion. If the target device

Callers 15

tMethod · 0.95
TMethod · 0.95
sparse_matrixFunction · 0.80
topkFunction · 0.80
argtopkFunction · 0.80
swapaxesFunction · 0.80
backwardMethod · 0.80
swapaxesFunction · 0.80
sbmFunction · 0.80
svd_peFunction · 0.80
forwardMethod · 0.80

Calls 1

SparseMatrixClass · 0.70

Tested by 4

test_pin_noncontiguousFunction · 0.64
test_dense_cheb_convFunction · 0.64