Justin Chu
ffaa6578b7
Revise deprecation warning for ONNX exporter ( #166692 )
...
Updated deprecation warning for ONNX export to reflect the current state.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166692
Approved by: https://github.com/titaiwangms
2025-10-31 17:23:55 +00:00
Justin Chu
160ab53dd5
Update weight tensor initialization in RMSNormalization ( #166550 )
...
Ensure a >1d tensor as weight for ORT compatibility.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166550
Approved by: https://github.com/titaiwangms
2025-10-31 14:29:27 +00:00
Yuanyuan Chen
030de07aff
[2/N] Use 'is' in callable comparisons ( #166685 )
...
It is generally advised to use `is/is not` for comparisons against torch functions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166685
Approved by: https://github.com/xmfan , https://github.com/mlazos
2025-10-31 08:08:07 +00:00
Yuanyuan Chen
2de4cf2102
[1/N] Remove unused loop variables ( #166258 )
...
This PR removes unused loop variables.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166258
Approved by: https://github.com/Lucaskabela , https://github.com/mlazos
2025-10-30 12:22:25 +00:00
linhaifeng
369f2d6951
[3/N] fix typo in other folders ( #166606 )
...
fix typo in other folders
#166374
#166126
_typos.toml
```bash
[files]
extend-exclude = ["tools/linter/dictionary.txt"]
[default.extend-words]
nd = "nd"
arange = "arange"
Nd = "Nd"
GLOBALs = "GLOBALs"
hte = "hte"
iy = "iy"
PN = "PN"
Dout = "Dout"
optin = "optin"
gam = "gam"
PTD = "PTD"
Sur = "Sur"
nin = "nin"
tme = "tme"
inpt = "inpt"
mis = "mis"
Raison = "Raison"
ouput = "ouput"
nto = "nto"
Onwer = "Onwer"
callibrate = "callibrate"
ser = "ser"
Metdata = "Metdata"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166606
Approved by: https://github.com/ezyang
2025-10-30 10:30:40 +00:00
Justin Chu
845da9c817
[ONNX] Ignore pyrefly errors in torchlib ( #166588 )
...
Fixes #166475
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166588
Approved by: https://github.com/titaiwangms
2025-10-30 03:43:52 +00:00
Justin Chu
a186aa8d6c
[ONNX] Change stacklevel in warning message for export ( #166558 )
...
Change to 3 so that the warning shows user callsite. (Where user calls torch.onnx.export)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166558
Approved by: https://github.com/titaiwangms
2025-10-29 20:45:25 +00:00
Maggie Moss
d1a6e006e0
Fix syntax for pyrefly errors ( #166496 )
...
Last one! This ensures all existing suppressions match the syntax expected and will silence only one error code
pyrefly check
lintrunner
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166496
Approved by: https://github.com/Skylion007 , https://github.com/mlazos
2025-10-29 20:00:25 +00:00
PyTorch MergeBot
1dd6b76914
Revert "[1/N] Remove unused loop variables ( #166258 )"
...
This reverts commit 76b2c37045 .
Reverted https://github.com/pytorch/pytorch/pull/166258 on behalf of https://github.com/atalman due to breaks test/distributed/test_serialization.py::TestSerialization::test_weights_only [GH job link](https://github.com/pytorch/pytorch/actions/runs/18894311802/job/53929321703 ) [HUD commit link](76b2c37045 ) ([comment](https://github.com/pytorch/pytorch/pull/166258#issuecomment-3460964612 ))
2025-10-29 11:10:37 +00:00
Justin Chu
c5701d0ab5
[ONNX] Create fake implementations for onnx ops; fix boolean mask in attention ( #165780 )
...
Previously we rely on the concreate implementation to generate fake implementation. This makes the fake implementation overly complicated and breaks in some cases when there are dynamic shapes.
This PR updates onnx op registration to instead take a dedicated fake implementation.
**Also fixed: When boolean mask is supplied to torch sdpa, it was previously taken the negation, which is incorrect.**
Fix https://github.com/pytorch/pytorch/issues/164909 Also taken changes from https://github.com/pytorch/pytorch/pull/156635
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165780
Approved by: https://github.com/titaiwangms
2025-10-29 04:51:49 +00:00
Yuanyuan Chen
76b2c37045
[1/N] Remove unused loop variables ( #166258 )
...
This PR removes unused loop variables.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166258
Approved by: https://github.com/Lucaskabela , https://github.com/mlazos
2025-10-29 01:34:15 +00:00
Ti-Tai Wang
0e46a10aa7
[ONNX] Warn when it's training ( #166412 )
...
Fixes #166163
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166412
Approved by: https://github.com/justinchuby
2025-10-28 19:01:05 +00:00
Maggie Moss
27302a4932
Fix error suppression syntax in onnx, jit, _dynamo ( #166249 )
...
Ensures pyrefly will only silence one specific error code
pyrefly check
lintrunner
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166249
Approved by: https://github.com/oulgen
2025-10-27 02:01:54 +00:00
Yuanyuan Chen
a60d9e1f6d
Fix flake8 B028 warnings ( #166224 )
...
This PR fixes flake8 B028 warning by specifying stacklevel=2 in `warnings.warn`. The advantage is that users can know more contextual information about PyTorch warnings.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166224
Approved by: https://github.com/ezyang
2025-10-26 06:18:55 +00:00
Maggie Moss
c7eee49525
Fix pyrefly ignores 1/n ( #166239 )
...
First diff adjusting the syntax for pyrefly: ignore suppressions so they only hide one class of type error.
Test:
lintrunner
pyrefly check
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166239
Approved by: https://github.com/oulgen
2025-10-26 00:44:10 +00:00
Maggie Moss
eb83c3ca23
Clean up unused Pyrefly suppressions ( #166178 )
...
Cleaning up ignores that are no longer needed in the repo and adding select suppressions so the main branch is clean.
test plan:
`lintrunner -a`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166178
Approved by: https://github.com/oulgen
2025-10-25 05:32:21 +00:00
Justin Chu
003601a70d
Set prefer_deferred_runtime_asserts_over_guards to True ( #165820 )
...
Set prefer_deferred_runtime_asserts_over_guards to True and allow a flag to control the behavior, just in case.
This option has enable the gemma3 model export with transformers==4.57. I am not sure how best to test it though.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165820
Approved by: https://github.com/titaiwangms
2025-10-25 03:38:19 +00:00
Ti-Tai Wang
c12293dcbe
[ONNX] Cover all FX passes into backed size oblivious ( #166151 )
...
Found a bug that after `run_decomposition()`, the shape could be fixed to 1. It's caused by the fact that all FX graph (related to shape inference) surgery should happen inside backed size oblivious patch.
```python
import torch
from transformers.models.phi3.modeling_phi3 import Phi3RMSNorm
# Previous to this PR, this will generate a fixed batch size
op = torch.onnx.export(
Phi3RMSNorm(256).eval(),
args=(),
kwargs={"hidden_states": torch.rand((1, 32, 256))},
dynamic_shapes={"hidden_states": {0: torch.export.Dim.DYNAMIC, 1: torch.export.Dim.DYNAMIC}},
)
# It is dynamic when it's only in torch.export
with torch.fx.experimental._config.patch(backed_size_oblivious=True):
ep = torch.onnx.export(
Phi3RMSNorm(256).eval(),
args=(),
kwargs={"hidden_states": torch.rand((1, 32, 256))},
dynamic_shapes={"hidden_states": {0: torch.export.Dim.DYNAMIC, 1: torch.export.Dim.DYNAMIC}},
)
# But when run_decomposition is called outside of the patch, it is static.
# ep = ep.run_decompositions()
print(ep)
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166151
Approved by: https://github.com/justinchuby
2025-10-24 03:25:16 +00:00
Yuanyuan Chen
3255e7872b
Enable all flake8-logging-format rules ( #164655 )
...
These rules are enabled by removing existing suppressions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164655
Approved by: https://github.com/janeyx99 , https://github.com/mlazos
2025-10-19 00:59:28 +00:00
Yuanyuan Chen
fdab48a7c1
Enable all PIE rules on ruff ( #165814 )
...
This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796 Enum contains duplicate value: {value}
PIE808 Unnecessary start argument in range
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
2025-10-18 07:36:18 +00:00
PyTorch MergeBot
24520b8386
Revert "Enable all PIE rules on ruff ( #165814 )"
...
This reverts commit c79dfdc655 .
Reverted https://github.com/pytorch/pytorch/pull/165814 on behalf of https://github.com/cyyever due to Need to cover more files ([comment](https://github.com/pytorch/pytorch/pull/165814#issuecomment-3417931863 ))
2025-10-18 07:21:08 +00:00
Yuanyuan Chen
c79dfdc655
Enable all PIE rules on ruff ( #165814 )
...
This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796 Enum contains duplicate value: {value}
PIE808 Unnecessary start argument in range
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
2025-10-18 06:40:12 +00:00
Ti-Tai Wang
543ddbf44c
[ONNX] Support renaming in dynamic axes to shapes conversion ( #165769 )
...
Discovered in ##165748
This PR also deprecates the conversion. ONNX exporter team does not intend to maintain the conversion in long term.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165769
Approved by: https://github.com/justinchuby
2025-10-18 01:11:20 +00:00
Justin Chu
fcbde24c1c
[ONNX] Remove common imports from torchlib ( #165156 )
...
The Rank and IsScalar functions are no longer used in the torchlib. Requires onnxscript v0.5.4
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165156
Approved by: https://github.com/Skylion007 , https://github.com/cyyever
2025-10-17 03:25:34 +00:00
Maggie Moss
d795fb225a
[RFC] Add pyrefly to lintrunner ( #165179 )
...
This will add pyrefly to lint runner as a warning only - and allow us to collect feedback about the tool before switching to pyrefly as the main type checker.
References the steps outlined here: : https://github.com/pytorch/pytorch/issues/163283 :
test plan:
`lintrunner init`
`lintrunner`
confirm when pyrefly errors are present results look like: https://gist.github.com/maggiemoss/e6cb2d015dd1ded560ae1329098cf33f
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165179
Approved by: https://github.com/ezyang
2025-10-16 20:07:09 +00:00
Ti-Tai Wang
cb328c0b20
[ONNX] TorchTensor supports tofile() ( #165195 )
...
Fixes #165120
ref: 43ebf47bb5/src/onnx_ir/tensor_adapters.py (L171-L200)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165195
Approved by: https://github.com/justinchuby
2025-10-13 19:12:06 +00:00
PyTorch MergeBot
3d1fa40ae1
Revert "[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml ( #164641 )"
...
This reverts commit 64108bdbed .
Reverted https://github.com/pytorch/pytorch/pull/164641 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](https://github.com/pytorch/pytorch/pull/164641#issuecomment-3386346474 ))
2025-10-09 15:42:51 +00:00
Yuanyuan Chen
a029675f6f
More ruff SIM fixes ( #164695 )
...
This PR applies ruff `SIM` rules to more files. Most changes are about simplifying `dict.get` because `None` is already the default value.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164695
Approved by: https://github.com/ezyang
2025-10-09 03:24:50 +00:00
Yuanyuan Chen
64108bdbed
[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml ( #164641 )
...
This PR removes `torch._cast_XXX` from generated OPs. They were deprecated in PyTorch 1
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164641
Approved by: https://github.com/albanD , https://github.com/justinchuby
2025-10-08 08:27:58 +00:00
Maggie Moss
086dec3235
Pyrefly suppressions 6/n ( #164877 )
...
Adds suppressions to pyrefly will typecheck clean: https://github.com/pytorch/pytorch/issues/163283
Almost there!
Test plan:
dmypy restart && python3 scripts/lintrunner.py -a
pyrefly check
step 1: delete lines in the pyrefly.toml file from the project-excludes field
step 2: run pyrefly check
step 3: add suppressions, clean up unused suppressions
before: https://gist.github.com/maggiemoss/4b3bf2037014e116bc00706a16aef199
after:
INFO 0 errors (5,064 ignored)
Only four directories left to enable
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164877
Approved by: https://github.com/oulgen
2025-10-08 02:30:57 +00:00
Maggie Moss
b13cd141b3
Add pyrefly suppressions ( #164748 )
...
Adds suppressions to pyrefly will typecheck clean: https://github.com/pytorch/pytorch/issues/163283
Test plan:
dmypy restart && python3 scripts/lintrunner.py -a
pyrefly check
step 1: delete lines in the pyrefly.toml file from the `project-excludes` field
step 2: run pyrefly check
step 3: add suppressions, clean up unused suppressions
before: https://gist.github.com/maggiemoss/4b3bf2037014e116bc00706a16aef199
after:
0 errors (4,263 ignored)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164748
Approved by: https://github.com/oulgen
2025-10-07 17:31:18 +00:00
Yuanyuan Chen
35c4130fd1
[2/N] Fix ruff warnings ( #164460 )
...
Apply ruff `SIM` rules.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164460
Approved by: https://github.com/ezyang
2025-10-04 03:40:32 +00:00
Yuanyuan Chen
a43c4c3972
[5/N] Apply ruff UP035 rule ( #164423 )
...
Continued code migration to enable ruff `UP035`. Most changes are about moving `Callable` from `typing` to `from collections.abc`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164423
Approved by: https://github.com/ezyang
2025-10-02 07:31:11 +00:00
Yuanyuan Chen
315ffdc1e4
[4/N] Apply ruff UP035 rule to python code ( #164206 )
...
Follows #164104
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164206
Approved by: https://github.com/albanD
2025-10-01 19:05:53 +00:00
Yuanyuan Chen
f7ab8a2710
[1/N] Fix ruff warnings ( #164333 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164333
Approved by: https://github.com/albanD
2025-10-01 16:48:32 +00:00
Yuanyuan Chen
cc8b14d09a
[2/N] Simplify "in" operation for containers of a single item ( #164323 )
...
These issues are detected by ruff [FURB171](https://docs.astral.sh/ruff/rules/single-item-membership-test/#single-item-membership-test-furb171 ).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164323
Approved by: https://github.com/justinchuby , https://github.com/Skylion007
2025-10-01 05:39:11 +00:00
Bob Ren
e9300b2b7c
remove allow-untyped-defs from ./torch/onnx/_internal/torchscript_exporter/_globals.py ( #163472 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163472
Approved by: https://github.com/Skylion007
ghstack dependencies: #163246 , #163469 , #163470
2025-09-23 03:50:29 +00:00
Simon Fan
175299416b
[mypy] add some import ignores to onnx ( #163133 )
...
these keep appearing when I run `lintrunner`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163133
Approved by: https://github.com/justinchuby
ghstack dependencies: #161458 , #162702
2025-09-17 09:32:38 +00:00
Henry
9babcae1ed
fix f-string in errors.py ( #163074 )
...
Add missing "f" for formatted f-string in UnsupportedOperandError, change "op_name" (undefined) to "name" for more descriptive error message in case of an unsupported operand with an unrecognized namespace.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163074
Approved by: https://github.com/justinchuby , https://github.com/Skylion007
2025-09-16 19:19:30 +00:00
Justin Chu
fdf68fa5d7
[ONNX] Fix rotary_embedding_23 implementation ( #162865 )
...
The implementation of rotary_embedding_23 when input is 3D was incorrect.
## Tested
Locally with
```py
import onnx_ir as ir
import onnx
import torch
import os
import numpy as np
base_path = "/home/justinchu/dev/onnx/onnx/backend/test/data/node"
test_names = [
"test_rotary_embedding",
"test_rotary_embedding_3d_input",
"test_rotary_embedding_interleaved",
"test_rotary_embedding_no_position_ids",
"test_rotary_embedding_no_position_ids_interleaved",
"test_rotary_embedding_no_position_ids_rotary_dim",
"test_rotary_embedding_with_interleaved_rotary_dim",
"test_rotary_embedding_with_rotary_dim",
]
model_paths = [os.path.join(base_path, name) for name in test_names]
for path in model_paths:
print(f"Checking {path} for issues...")
model = onnx.load(os.path.join(path, "model.onnx"))
input0 = ir.from_proto(
onnx.load_tensor(os.path.join(path, "test_data_set_0", "input_0.pb"))
).numpy()
input1 = ir.from_proto(
onnx.load_tensor(os.path.join(path, "test_data_set_0", "input_1.pb"))
).numpy()
input2 = ir.from_proto(
onnx.load_tensor(os.path.join(path, "test_data_set_0", "input_2.pb"))
).numpy()
if os.path.exists(os.path.join(path, "test_data_set_0", "input_3.pb")):
input3 = ir.from_proto(
onnx.load_tensor(os.path.join(path, "test_data_set_0", "input_3.pb"))
).numpy()
else:
input3 = None
output0 = ir.from_proto(
onnx.load_tensor(os.path.join(path, "test_data_set_0", "output_0.pb"))
).numpy()
m = ir.from_proto(model)
node = m.graph[-1]
print(node)
assert node.op_type == "RotaryEmbedding"
interleaved = node.attributes.get_int("interleaved", 0)
num_heads = node.attributes.get_int("num_heads", 0)
rotary_embedding_dim = node.attributes.get_int("rotary_embedding_dim", 0)
torch_out = torch.onnx.ops.rotary_embedding(
torch.tensor(input0),
torch.tensor(input1),
torch.tensor(input2),
position_ids=torch.tensor(input3) if input3 is not None else None,
interleaved=bool(interleaved),
num_heads=num_heads,
rotary_embedding_dim=rotary_embedding_dim,
)
torch_out = torch_out.detach().cpu().numpy()
np.testing.assert_allclose(torch_out, output0)
```
Fix https://github.com/pytorch/pytorch/issues/162848
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162865
Approved by: https://github.com/kunal-vaishnavi , https://github.com/titaiwangms
2025-09-16 03:30:05 +00:00
Justin Chu
d71a6497b7
Fix typo in ONNX export error message ( #162819 )
...
Fix another "summit" 😅
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162819
Approved by: https://github.com/cyyever , https://github.com/titaiwangms
2025-09-12 16:34:49 +00:00
Ti-Tai Wang
2335f90414
[ONNX] Support enable_gqa when dropout is non-zero ( #162771 )
...
Fixes #162258
Related to https://github.com/microsoft/onnxscript/pull/2558
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162771
Approved by: https://github.com/justinchuby
2025-09-12 04:00:57 +00:00
justinchuby
43d9b5ecaa
[ONNX] Set fallback=False by default ( #162726 )
...
This change addresses confusing error messages users encounter when using the ONNX exporter with default settings. Previously, `fallback=True` was the default, which would attempt to fall back to the TorchScript exporter when the dynamo path failed, leading to mixed error messages that obscured the actual issues.
## Problem
When `fallback=True` by default:
- Users get confusing error messages mixing dynamo and TorchScript export failures
- Error messages tell users to provide the `f` argument unnecessarily
- Dynamo error messages get flushed with TorchScript errors when both paths fail
- Users expecting the dynamo path get unexpected fallback behavior
## Solution
Changed the default from `fallback=True` to `fallback=False` in both:
- `torch.onnx.export()` function
- `torch.onnx._internal.exporter._compat.export_compat()` function
## Impact
**Before:**
```python
# Would fallback to TorchScript on dynamo failure, causing mixed error messages
torch.onnx.export(model, args)
```
**After:**
```python
# Clean dynamo-only errors by default
torch.onnx.export(model, args)
# Advanced users can still opt-in to fallback behavior
torch.onnx.export(model, args, fallback=True)
```
Fixes #162697
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162726
Approved by: https://github.com/titaiwangms , https://github.com/xadupre
2025-09-11 18:09:58 +00:00
Justin Chu
7e2e83cdbe
[ONNX] Update export docstring ( #162622 )
...
Update export docstring to reflect the latest configuration.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162622
Approved by: https://github.com/titaiwangms
2025-09-10 20:29:46 +00:00
Masaki Kozuki
fefc406a3d
fix typo: summit -> submit ( #162587 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162587
Approved by: https://github.com/justinchuby
2025-09-10 14:43:53 +00:00
Justin Chu
c66e58b7d0
[ONNX] Expose the testing module ( #162495 )
...
* Created a new module `torch/onnx/testing.py` that exposes the `assert_onnx_program` function for testing exported ONNX models.
* Updated the ONNX documentation (`docs/source/onnx.md`) to include `onnx_testing` in the list of relevant modules.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162495
Approved by: https://github.com/titaiwangms , https://github.com/xadupre
2025-09-10 01:40:24 +00:00
Vinayak Pawar
9ad5e8edb1
Improve typing of ONNX decorators with ParamSpec ( #162332 )
...
## Summary
This PR improves typing in ONNX-related modules by replacing TypeVar bound to Callable[..., Any] with ParamSpec to preserve parameter types and avoid type erasure in decorator functions.
## Changes
- `torch/onnx/_internal/exporter/_flags.py`: Replace TCallable TypeVar with ParamSpec
- `torch/onnx/ops/_impl.py`: Replace _T TypeVar with ParamSpec for _onnx_op decorator
- `torch/onnx/_internal/exporter/_torchlib/_torchlib_registry.py`: Replace _T TypeVar with ParamSpec
## Motivation
The previous implementation used TypeVar bound to Callable which erased parameter type information to Any. ParamSpec preserves the exact parameter types and return types, providing better type safety and IDE support.
## Testing
- Verified all changes compile and import correctly
- Created comprehensive test suite to validate ParamSpec functionality
- No linting errors introduced
- Maintains backward compatibility
Fixes #142306
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162332
Approved by: https://github.com/Skylion007
2025-09-07 18:06:03 +00:00
Justin Chu
3771380f83
[ONNX] Hide draft export under a flag ( #162225 )
...
Use `TORCH_ONNX_ENABLE_DRAFT_EXPORT` to control whether draft_export should be used as a strategy in onnx export.
Follow up of https://github.com/pytorch/pytorch/pull/161454
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162225
Approved by: https://github.com/xadupre , https://github.com/titaiwangms
2025-09-05 19:54:50 +00:00
Justin Chu
bd39e47fee
[ONNX] Default to dynamo export ( #159646 )
...
Set dynamo=True and enable fallback.
1. Implemented the compatible behavior where BytesIO objects as `f` is accepted
2. Update tests to explicitly set dynamo=False
#151693
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159646
Approved by: https://github.com/titaiwangms
2025-09-02 22:45:55 +00:00
Justin Chu
f0c391102b
[ONNX] Remove private members from torch.onnx ( #161546 )
...
Remove import of two functions
- _run_symbolic_function
- _run_symbolic_method
to the `torch.onnx` namespace.
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161546
Approved by: https://github.com/titaiwangms
ghstack dependencies: #161323 , #161449
2025-09-02 16:31:23 +00:00