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

Method call_hasattr

torch/_dynamo/variables/nn_module.py:123–131  ·  view source on GitHub ↗
(self, tx, name: str)

Source from the content-addressed store, hash-verified

121 return result
122
123 def call_hasattr(self, tx, name: str) -> "VariableTracker":
124 mod = tx.output.get_submodule(self.module_key)
125 result = hasattr(mod, name)
126 install_guard(
127 NNModuleSource(AttrSource(self.source, name)).make_guard(
128 GuardBuilder.HASATTR
129 )
130 )
131 return variables.ConstantVariable.create(result)
132
133 def is_training(self, tx):
134 mod = tx.output.get_submodule(self.module_key)

Callers

nothing calls this directly

Calls 6

install_guardFunction · 0.85
NNModuleSourceClass · 0.85
AttrSourceClass · 0.85
get_submoduleMethod · 0.45
make_guardMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected