(nx)
| 180 | |
| 181 | |
| 182 | def test_gmm_ot_plan_density(nx): |
| 183 | m_s, m_t, C_s, C_t, w_s, w_t = get_gmms(nx) |
| 184 | rng = np.random.RandomState(seed=42) |
| 185 | n = 7 |
| 186 | x = nx.from_numpy(rng.randn(n, 3)) |
| 187 | y = nx.from_numpy(rng.randn(n + 1, 3)) |
| 188 | |
| 189 | density = gmm_ot_plan_density(x, y, m_s, m_t, C_s, C_t, w_s, w_t) |
| 190 | assert density.shape == (n, n + 1) |
| 191 | |
| 192 | plan = gmm_ot_plan(m_s, m_t, C_s, C_t, w_s, w_t) |
| 193 | gmm_ot_plan_density(x, x, m_s, m_t, C_s, C_t, w_s, w_t, plan=plan) |
| 194 | |
| 195 | with pytest.raises(AssertionError): |
| 196 | gmm_ot_plan_density(x[:, 1:], y, m_s, m_t, C_s, C_t, w_s, w_t) |
| 197 | |
| 198 | |
| 199 | @pytest.skip_backend("tf") # skips because of array assignment |
nothing calls this directly
no test coverage detected