(self)
| 880 | |
| 881 | @contextlib.contextmanager |
| 882 | def _dummy_context(self): |
| 883 | # Yields a dummy context. |
| 884 | context = InvocationContext( |
| 885 | name="root", |
| 886 | parent=None, |
| 887 | module=_new_module("test"), |
| 888 | is_training=True, |
| 889 | prng_key=jax.random.PRNGKey(123), |
| 890 | state=jnp.arange(2, dtype=jnp.int32) * 10, |
| 891 | output_collection=new_output_collection(), |
| 892 | ) |
| 893 | with set_current_context(context): |
| 894 | yield context |
| 895 | |
| 896 | def test_context(self): |
| 897 | # Running outside of context should error. |
no test coverage detected