(nx)
| 70 | |
| 71 | |
| 72 | def test_gmm_pdf(nx): |
| 73 | rng = np.random.RandomState(seed=42) |
| 74 | n = 7 |
| 75 | d = 3 |
| 76 | x = nx.from_numpy(rng.randn(n, d)) |
| 77 | m, _, C, _, w, _ = get_gmms(nx) |
| 78 | pdf = gmm_pdf(x, m, C, w) |
| 79 | assert pdf.shape == (n,) |
| 80 | |
| 81 | x = nx.from_numpy(rng.randn(n, n, d)) |
| 82 | pdf = gmm_pdf(x, m, C, w) |
| 83 | assert pdf.shape == ( |
| 84 | n, |
| 85 | n, |
| 86 | ) |
| 87 | |
| 88 | with pytest.raises(AssertionError): |
| 89 | gmm_pdf(x, m[:-1], C, w) |
| 90 | |
| 91 | |
| 92 | @pytest.skip_backend("tf") # skips because of array assignment |
nothing calls this directly
no test coverage detected