viable/strict/1792517296: [fx] Make _Patcher's already-patched guard actually fire (#201464)
- PyTorch: 2595 events in the last 90 days
- PyTorch: 2556th Release in the last 90 days
- Previous: earlier the same day · viable/strict/1792504417
What happened
Summary: _Patcher.patch and _Patcher.patch_method mark each new wrapper with new_fn.__fx_already_patched = deduplicate . Inside class _Patcher , Python name-mangles that attribute to _Patcher__fx_already_patched , while the guard reads getattr(..., "__fx_already_patched", False) , so the guard never fires. As a result, a re-entrant trace (one that starts while a module global already holds FX's wrapper for a torch.f…
Summary assembled by rule from the sources below