We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 172640e commit 539e206Copy full SHA for 539e206
torch_sparse/tensor.py
@@ -243,6 +243,15 @@ def avg_row_length(self) -> float:
243
def avg_col_length(self) -> float:
244
return self.nnz() / self.sparse_size(1)
245
246
+ def bandwidth(self) -> int:
247
+ row, col, _ = self.coo()
248
+ return int((row - col).abs_().max())
249
+
250
+ def bandwidth_proportion(self, bandwidth: int) -> float:
251
252
+ tmp = (row - col).abs_()
253
+ return int((tmp <= bandwidth).sum()) / self.nnz()
254
255
def is_quadratic(self) -> bool:
256
return self.sparse_size(0) == self.sparse_size(1)
257
0 commit comments