r"""Compute squared euclidean distance between samples (autograd)
(x1, x2)
| 35 | |
| 36 | |
| 37 | def 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 | |
| 44 | def sinkhorn(w1, w2, M, reg, k): |
no test coverage detected