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

Function norm_batch

ot/batch/_utils.py:25–29  ·  view source on GitHub ↗

Computes the lp norm of a batch of vectors u.

(u, p=2, nx=None)

Source from the content-addressed store, hash-verified

23
24
25def norm_batch(u, p=2, nx=None):
26 """Computes the lp norm of a batch of vectors u."""
27 if nx is None:
28 nx = get_backend(u)
29 return nx.sum(u**p, axis=1) ** (1 / p)
30
31
32def bmv(A, b, nx):

Callers 2

bregman_projection_batchFunction · 0.85

Calls 2

get_backendFunction · 0.90
sumMethod · 0.45

Tested by

no test coverage detected