Skip to content

Commit

Permalink
Make {testing,debug_utils,utils}.py pass follow_imports typechecking …
Browse files Browse the repository at this point in the history
…(#113519)

Summary:
Notes:

* `debug_insert_nops` in testing.py was passing `None` to the compiler_fn
parameter of `OutputGraph`, hence the modifications there.
* I added `disable-error-code="method-assign"` to debug_utils.py as it
does several such assignments. I guess mypy doesn't like it because it
makes code near-impossible to safely typecheck.

X-link: pytorch/pytorch#113519
Approved by: https://github.com/Skylion007
ghstack dependencies: #113413, #113518

Reviewed By: huydhn

Differential Revision: D51286997

Pulled By: int3

fbshipit-source-id: 47f11860806f18a5d1c99f4d780febf66e63689c
  • Loading branch information
int3 authored and facebook-github-bot committed Nov 14, 2023
1 parent 4d01954 commit 317b36a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ def disable_cache_limit():
guard_failures: DefaultDict[Any, List[Any]] = collections.defaultdict(list)

# Keep a record of graph break reasons for logging
graph_break_reasons: List["torch._dynamo.output_graph.GraphCompileReasons"] = list()
graph_break_reasons: List["torch._dynamo.output_graph.GraphCompileReason"] = list()

# keep record of compiled code, if we are in "error if recompile"
# to track code that dynamo has compiled previously
Expand Down Expand Up @@ -1972,7 +1972,9 @@ def build_checkpoint_variable(**options):

# TODO - This is a temporary situation where we have two versions of
# checkpointing implementation. We will converge on one and remove the other.
activation_checkpoint_op = higher_order_ops.tag_activation_checkpoint
activation_checkpoint_op: "torch._ops.HigherOrderOperator" = (
higher_order_ops.tag_activation_checkpoint
)
if torch._functorch.config.functionalize_rng_ops:
activation_checkpoint_op = higher_order_ops.wrap_activation_checkpoint

Expand Down

0 comments on commit 317b36a

Please sign in to comment.