Revert "[export] Skip the check instead of disable (#164084)"

This reverts commit c2768d0f5af840a94c342ed9eac3e26c819aa3f0.

Reverted https://github.com/pytorch/pytorch/pull/164084 on behalf of https://github.com/yangw-dev due to broke internal tests ([comment](https://github.com/pytorch/pytorch/pull/164084#issuecomment-3348862668))
This commit is contained in:
PyTorch MergeBot
2025-09-29 20:09:13 +00:00
parent 6650f5af74
commit 9e792f583a

View File

@ -219,6 +219,7 @@ def _convert_guards_code_to_fn(
return guards_fn
@torch._dynamo.disable
def _check_input_constraints_for_module(self, args, kwargs):
flat_args_with_path = _check_inputs_match(args, kwargs, self._in_spec)
_check_input_constraints_for_graph(
@ -240,11 +241,8 @@ def _check_input_constraints_pre_hook(self, args, kwargs):
_check_inputs_match(args, kwargs, self._in_spec)
return
# NOTE: for some reason, Dynamo is tracing into this, we should see why and
# put compile at the right place. Until then, we can skip the input
# constraint checks.
if not torch.compiler.is_dynamo_compiling():
_check_input_constraints_for_module(self, args, kwargs)
# NOTE: this call is Dynamo disabled, as it used to be
_check_input_constraints_for_module(self, args, kwargs)
def _unlift_inputs_as_getattr(