mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Revert "[dynamo][executorch] Do not trace into exeuctorch LoweredBackendModule (#165126)"
This reverts commit 41936f4cf6ff93b70d81f6a23811d43a0647f1e1. Reverted https://github.com/pytorch/pytorch/pull/165126 on behalf of https://github.com/anijain2305 due to https://github.com/pytorch/pytorch/pull/165172 is the right way ([comment](https://github.com/pytorch/pytorch/pull/165126#issuecomment-3391975498))
This commit is contained in:
@ -117,21 +117,6 @@ def is_dynamic_nn_module(obj: Any, is_export: bool) -> bool:
|
||||
return True
|
||||
if hasattr(obj, "torchdynamo_force_dynamic"):
|
||||
return obj.torchdynamo_force_dynamic
|
||||
|
||||
# TODO - Executorch uses a delegate mechanism to lower nn.Module to a
|
||||
# backend. This today requires Dynamo to not look inside the
|
||||
# LoweredBackendModule. We should perhaps revisit this to understand
|
||||
# why Dynamo is tracing this module.
|
||||
if isinstance(obj, torch.nn.Module):
|
||||
try:
|
||||
cls = type(obj)
|
||||
if cls.__module__.startswith("executorch") and cls.__name__.endswith(
|
||||
"LoweredBackendModule"
|
||||
):
|
||||
return False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if (
|
||||
isinstance(obj, torch.nn.Module)
|
||||
and config.inline_inbuilt_nn_modules
|
||||
|
Reference in New Issue
Block a user