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

Method _bench

ot/backend.py:1386–1398  ·  view source on GitHub ↗
(self, callable, *args, n_runs=1, warmup_runs=1)

Source from the content-addressed store, hash-verified

1384 return "CPU"
1385
1386 def _bench(self, callable, *args, n_runs=1, warmup_runs=1):
1387 results = dict()
1388 for type_as in self.__type_list__:
1389 inputs = [self.from_numpy(arg, type_as=type_as) for arg in args]
1390 for _ in range(warmup_runs):
1391 callable(*inputs)
1392 t0 = time.perf_counter()
1393 for _ in range(n_runs):
1394 callable(*inputs)
1395 t1 = time.perf_counter()
1396 key = ("Numpy", self.device_type(type_as), self.bitsize(type_as))
1397 results[key] = (t1 - t0) / n_runs
1398 return results
1399
1400 def solve(self, a, b):
1401 return np.linalg.solve(a, b)

Callers

nothing calls this directly

Calls 3

device_typeMethod · 0.95
bitsizeMethod · 0.95
from_numpyMethod · 0.80

Tested by

no test coverage detected