|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | | -from contextlib import nullcontext |
15 | | - |
16 | 14 | import numpy as np |
17 | 15 | import pytest |
18 | 16 |
|
@@ -44,15 +42,13 @@ def test_dirichlet_multinomial_dims(mode): |
44 | 42 | with pm.Model(coords={"trial": range(3), "item": range(3)}) as m: |
45 | 43 | dm = DirichletMultinomial("dm", n=5, a=np.eye(3) * 1e6 + 0.01, dims=("trial", "item")) |
46 | 44 |
|
47 | | - # JAX does not allow us to JIT a function with dynamic shape |
48 | | - expected_ctxt = pytest.raises(TypeError) if mode == "JAX" else nullcontext() |
49 | | - with expected_ctxt: |
50 | | - pm.draw(dm, mode=mode) |
| 45 | + dm_draws = pm.draw(dm, mode=mode, random_seed=36) |
| 46 | + np.testing.assert_equal(dm_draws, np.eye(3) * 5) |
51 | 47 |
|
52 | | - # Should be fine after freezing the dims that specify the shape |
| 48 | + # Should also work after freezing the dims that specify the shape |
53 | 49 | frozen_dm = freeze_dims_and_data(m)["dm"] |
54 | | - dm_draws = pm.draw(frozen_dm, mode=mode, random_seed=36) |
55 | | - np.testing.assert_equal(dm_draws, np.eye(3) * 5) |
| 50 | + frozen_dm_draws = pm.draw(frozen_dm, mode=mode, random_seed=36) |
| 51 | + np.testing.assert_equal(frozen_dm_draws, np.eye(3) * 5) |
56 | 52 |
|
57 | 53 |
|
58 | 54 | def test_mvstudentt(mode): |
|
0 commit comments