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

Function dist

ot/dr.py:37–41  ·  view source on GitHub ↗

r"""Compute squared euclidean distance between samples (autograd)

(x1, x2)

Source from the content-addressed store, hash-verified

35
36
37def dist(x1, x2):
38 r"""Compute squared euclidean distance between samples (autograd)"""
39 x1p2 = np.sum(np.square(x1), 1)
40 x2p2 = np.sum(np.square(x2), 1)
41 return x1p2.reshape((-1, 1)) + x2p2.reshape((1, -1)) - 2 * np.dot(x1, x2.T)
42
43
44def sinkhorn(w1, w2, M, reg, k):

Callers 15

_init_lr_sinkhornFunction · 0.70
kernel_nystroemFunction · 0.70
solve_otFunction · 0.70
solve_sampleFunction · 0.70
joint_OT_mapping_linearFunction · 0.70
joint_OT_mapping_kernelFunction · 0.70
loss_dual_entropicFunction · 0.70
plan_dual_entropicFunction · 0.70
loss_dual_quadraticFunction · 0.70
plan_dual_quadraticFunction · 0.70

Calls 3

sumMethod · 0.45
reshapeMethod · 0.45
dotMethod · 0.45

Tested by

no test coverage detected