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

Method add_child

axlearn/common/module.py:265–274  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

263 return name in self.summaries
264
265 def add_child(self, name: str) -> "OutputCollection":
266 if not re.fullmatch("^[a-z][a-z0-9_]*$", name):
267 raise ValueError(f'Invalid child name "{name}"')
268 if name in self:
269 raise OutputConflictError(f"{name} already present")
270 child = new_output_collection()
271 self.summaries[name] = child.summaries
272 self.state_updates[name] = child.state_updates
273 self.module_outputs[name] = child.module_outputs
274 return child
275
276 def update(self, collection: "OutputCollection"):
277 self.summaries.update(**collection.summaries)

Callers 6

_runMethod · 0.45
add_childMethod · 0.45
child_contextFunction · 0.45
test_set_state_updateMethod · 0.45

Calls 2

OutputConflictErrorClass · 0.85
new_output_collectionFunction · 0.85

Tested by 2

test_set_state_updateMethod · 0.36