Skip to content

Commit

Permalink
[dynamo][inline-inbuilt-nn-modules] Bug fix - Only unspecialized nn m…
Browse files Browse the repository at this point in the history
…odules (#126303)

Pull Request resolved: #126303
Approved by: https://github.com/mlazos, https://github.com/laithsakka
  • Loading branch information
anijain2305 authored and ZelboK committed May 19, 2024
1 parent 2524635 commit d3d25a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion torch/_dynamo/mutation_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ def is_dynamic_nn_module(obj, is_export):
# 1) Input signature problem because params are lifted as inputs
# 2) nn module stack info changes
# 3) adjust failing tests
if config.inline_inbuilt_nn_modules and not is_export:
if (
isinstance(obj, torch.nn.Module)
and config.inline_inbuilt_nn_modules
and not is_export
):
return True
dyn = GenerationTracker.dynamic_classes.get(type(obj)) or GenerationTracker.check(
obj
Expand Down

0 comments on commit d3d25a3

Please sign in to comment.