MCPcopy Create free account
hub / github.com/apple/axlearn / _dummy_context

Method _dummy_context

axlearn/common/module_test.py:882–894  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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.

Callers 3

test_basicMethod · 0.95
test_drop_outputMethod · 0.95
test_rematMethod · 0.95

Calls 4

InvocationContextClass · 0.90
new_output_collectionFunction · 0.90
set_current_contextFunction · 0.90
_new_moduleFunction · 0.85

Tested by

no test coverage detected