Skip to content

Commit f9d2600

Browse files
Andrew Gupytorchmergebot
authored andcommitted
[Dynamo] Rename GuardBuilder.guarded_code -> check_fn_manager (#93934)
I was reading Dynamo code to learn and thought to clarify this naming to remove the `TODO`. Pull Request resolved: #93934 Approved by: https://github.com/ezyang
1 parent f5e9c8c commit f9d2600

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

torch/_dynamo/guards.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(
8888
id_ref: Callable[[Type[object]], str],
8989
source_ref: Callable[[Source], str],
9090
scope: Optional[Dict[str, object]],
91-
guarded_code: "CheckFunctionManager",
91+
check_fn_manager: "CheckFunctionManager",
9292
renames=True,
9393
):
9494
self.id_ref = id_ref
@@ -134,8 +134,7 @@ def __init__(
134134
self.tensor_check_examples: List[torch.Tensor] = []
135135

136136
self.tensor_check_ids: Dict[str, int] = {}
137-
# TODO: tf is this naming
138-
self.guarded_code: CheckFunctionManager = guarded_code
137+
self.check_fn_manager: CheckFunctionManager = check_fn_manager
139138

140139
# Warning: use this with care! This lets you access what the current
141140
# value of the value you are guarding on is. You probably don't want
@@ -380,7 +379,7 @@ def ODICT_KEYS(self, guard):
380379
self._produce_guard_code(guard, code)
381380

382381
def OBJECT_MUTATION(self, guard: Guard):
383-
mutation_guard.watch(self.get(guard.name), self.guarded_code)
382+
mutation_guard.watch(self.get(guard.name), self.check_fn_manager)
384383

385384
def GRAD_MODE(self, guard: Guard):
386385
"""Guard on the initial grad state"""
@@ -398,7 +397,7 @@ def SHAPE_ENV(self, guard: Guard):
398397
# shape variables to sources from tracked_fakes. This must happen after
399398
# tensor checks.
400399
assert guard.name == ""
401-
output_graph = self.guarded_code.output_graph
400+
output_graph = self.check_fn_manager.output_graph
402401
# NB: self.output_graph can be None in the debug_nops tests
403402
fs = output_graph.tracked_fakes
404403
code = output_graph.shape_env.codegen_guards(

0 commit comments

Comments
 (0)