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

Method invoke_self_multiple_times

axlearn/common/module_test.py:376–382  ·  view source on GitHub ↗
(self, x: Tensor, n: int)

Source from the content-addressed store, hash-verified

374 return x
375
376 def invoke_self_multiple_times(self, x: Tensor, n: int) -> Tensor:
377 # To call self.inc multiple times, create a context explicitly for each invocation
378 # with a different `name`.
379 for i in range(n):
380 with child_context(f"self_call{i}", module=self):
381 x = self.inc(x)
382 return x
383
384 def invoke_child_multiple_times_causing_conflict(self, x: Tensor, n: int) -> Tensor:
385 for _ in range(n):

Callers

nothing calls this directly

Calls 2

incMethod · 0.95
child_contextFunction · 0.90

Tested by

no test coverage detected