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

Method replace

torch/_dynamo/guards.py:904–907  ·  view source on GitHub ↗
(self, expr: str)

Source from the content-addressed store, hash-verified

902 counter.visit(ast.parse(e))
903
904 def replace(self, expr: str) -> Tuple[List[str], str]:
905 replacer = self.Replacer(self._config, self._new_var)
906 new_node = replacer.visit(ast.parse(expr))
907 return replacer.preface, _ast_unparse(new_node)
908
909
910def must_add_nn_module_guards(guard):

Callers 15

registerFunction · 0.45
__init__.pyFile · 0.45
apply_optionsMethod · 0.45
storage_to_tensor_typeFunction · 0.45
_get_cache_or_reloadFunction · 0.45
_qualified_nameFunction · 0.45
_typeFunction · 0.45
startFunction · 0.45
get_alias_infoFunction · 0.45

Calls 3

visitMethod · 0.95
_ast_unparseFunction · 0.85
parseMethod · 0.45