()
| 111 | |
| 112 | |
| 113 | def test_sliced_same_proj(): |
| 114 | n_projections = 10 |
| 115 | seed = 12 |
| 116 | rng = np.random.RandomState(0) |
| 117 | X = rng.randn(8, 2) |
| 118 | Y = rng.randn(8, 2) |
| 119 | cost1, log1 = ot.sliced_wasserstein_distance( |
| 120 | X, Y, seed=seed, n_projections=n_projections, log=True |
| 121 | ) |
| 122 | P = get_random_projections(X.shape[1], n_projections=10, seed=seed) |
| 123 | cost2, log2 = ot.sliced_wasserstein_distance(X, Y, projections=P, log=True) |
| 124 | |
| 125 | assert np.allclose(log1["projections"], log2["projections"]) |
| 126 | assert np.isclose(cost1, cost2) |
| 127 | |
| 128 | |
| 129 | def test_sliced_backend(nx): |
nothing calls this directly
no test coverage detected