MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / add_module

Method add_module

python/oneflow/nn/graph/proxy.py:310–324  ·  view source on GitHub ↗
(self, name: str, module: Optional[Module])

Source from the content-addressed store, hash-verified

308 return self.to(GraphModule)._belonged_graph._unique_identity_op_dict[key]
309
310 def add_module(self, name: str, module: Optional[Module]) -> None:
311 if isinstance(module, Module):
312 self.__setattr__(
313 name,
314 get_block_cls(module)(
315 module,
316 self.to(GraphModule)._name_prefix
317 + self.to(GraphModule)._name
318 + ".",
319 name,
320 self.to(GraphModule)._belonged_graph,
321 ),
322 )
323 elif isinstance(module, Proxy):
324 self.__setattr__(name, module)
325
326 def register_parameter(self, name: str, param: Optional[Parameter]) -> None:
327 self.__setattr__(

Callers

nothing calls this directly

Calls 2

__setattr__Method · 0.95
toMethod · 0.45

Tested by

no test coverage detected