MCPcopy Create free account
hub / github.com/PythonOT/POT / coo_matrix

Method coo_matrix

ot/backend.py:2277–2287  ·  view source on GitHub ↗
(self, data, rows, cols, shape=None, type_as=None)

Source from the content-addressed store, hash-verified

2275 return torch.randperm(n=size, generator=self.rng_)
2276
2277 def coo_matrix(self, data, rows, cols, shape=None, type_as=None):
2278 if type_as is None:
2279 return torch.sparse_coo_tensor(torch.stack([rows, cols]), data, size=shape)
2280 else:
2281 return torch.sparse_coo_tensor(
2282 torch.stack([rows, cols]),
2283 data,
2284 size=shape,
2285 dtype=type_as.dtype,
2286 device=type_as.device,
2287 )
2288
2289 def issparse(self, a):
2290 return getattr(a, "is_sparse", False) or getattr(a, "is_sparse_csr", False)

Callers 1

eliminate_zerosMethod · 0.95

Calls 1

stackMethod · 0.45

Tested by

no test coverage detected