mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[dynamo][easy] forbid_in_graph check to use getattr_static (#124445)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124445 Approved by: https://github.com/yanboliang, https://github.com/jansel
This commit is contained in:
parent
97ccfad915
commit
febc4d8759
|
|
@ -3064,7 +3064,7 @@ def is_callable_disallowed(obj) -> bool:
|
|||
|
||||
def is_forbidden(obj) -> bool:
|
||||
_maybe_init_lazy_module(obj)
|
||||
return getattr(obj, "_dynamo_forbidden", False)
|
||||
return inspect.getattr_static(obj, "_dynamo_forbidden", False)
|
||||
|
||||
|
||||
def is_builtin_callable(obj) -> bool:
|
||||
|
|
|
|||
|
|
@ -791,7 +791,10 @@ class UnspecializedNNModuleVariable(UserDefinedObjectVariable):
|
|||
kwargs,
|
||||
)
|
||||
|
||||
if id(method.__code__) in self._nn_module_method_ids():
|
||||
if (
|
||||
hasattr(method, "__code__")
|
||||
and id(method.__code__) in self._nn_module_method_ids()
|
||||
):
|
||||
unimplemented(f"UnspecializedNNModuleVariable missing {name}")
|
||||
|
||||
# "_parameters" in self.value.__dict__ checks that module is initialized
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user