diff --git a/torch/_dynamo/variables/builder.py b/torch/_dynamo/variables/builder.py index 6eaaeb9b56da..6612c8919327 100644 --- a/torch/_dynamo/variables/builder.py +++ b/torch/_dynamo/variables/builder.py @@ -177,11 +177,7 @@ from .misc import ( TorchVersionVariable, TypingVariable, ) -from .nn_module import ( - FSDPManagedNNModuleVariable, - UnspecializedBuiltinNNModuleVariable, - UnspecializedNNModuleVariable, -) +from .nn_module import FSDPManagedNNModuleVariable, UnspecializedNNModuleVariable from .optimizer import OptimizerVariable from .script_object import TorchScriptObjectVariable @@ -1278,10 +1274,7 @@ class VariableBuilder: # this will get cleaned up once compile ends self.tx.output.nn_modules[self.name] = value - if value.__module__.startswith(("torch.nn.", "torch.ao.")): - result = UnspecializedBuiltinNNModuleVariable(value, source=self.source) - else: - result = UnspecializedNNModuleVariable(value, source=self.source) + result = UnspecializedNNModuleVariable(value, source=self.source) if not SideEffects.cls_supports_mutation_side_effects(type(value)): # don't allow STORE_ATTR mutation with custom __setattr__ return result