()
| 63 | |
| 64 | |
| 65 | def test_bregman_batch(): |
| 66 | batchsize = 4 |
| 67 | d = 2 |
| 68 | n = 4 |
| 69 | rng = np.random.RandomState(0) |
| 70 | X = rng.rand(batchsize, n, d) |
| 71 | M = dist_batch(X, X) |
| 72 | K = np.exp(-M / 0.01) |
| 73 | log_K = -M / 0.01 |
| 74 | res = bregman_projection_batch(K, max_iter=50, tol=1e-10) |
| 75 | plan = res["T"] |
| 76 | res_log = bregman_log_projection_batch(log_K, max_iter=50, tol=1e-10) |
| 77 | plan_log = res_log["T"] |
| 78 | np.testing.assert_allclose(plan, plan_log, atol=1e-3) |
| 79 | |
| 80 | |
| 81 | @pytest.mark.parametrize("metric", ["sqeuclidean", "euclidean", "minkowski", "kl"]) |
nothing calls this directly
no test coverage detected