MCPcopy Create free account
hub / github.com/pytorch/pytorch / get_submodule

Method get_submodule

torch/_dynamo/output_graph.py:642–650  ·  view source on GitHub ↗
(self, keys)

Source from the content-addressed store, hash-verified

640 return len(list(self.graph.nodes)) == 0
641
642 def get_submodule(self, keys):
643 assert keys
644 obj: Union[torch.nn.Module, Dict[str, torch.nn.Module]] = self.nn_modules
645 for k in keys.split("."):
646 if isinstance(obj, dict):
647 obj = obj[k]
648 else:
649 obj = getattr(obj, k)
650 return obj
651
652 def new_var(self, name="tmp"):
653 existing = set(self.code_options["co_varnames"])

Callers 15

run_nodeFunction · 0.45
innerFunction · 0.45
inline_call_Method · 0.45
call_functionMethod · 0.45
const_getattrMethod · 0.45
call_idMethod · 0.45
_comparisonMethod · 0.45
unpack_var_sequenceMethod · 0.45
call_hasattrMethod · 0.45
is_trainingMethod · 0.45
var_getattrMethod · 0.45

Calls 2

isinstanceFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected