8000 warn instead · pytorch/pytorch@63919ed · GitHub
[go: up one dir, main page]

Skip to content

Commit 63919ed

Browse files
committed
warn instead
1 parent 3216508 commit 63919ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

torch/onnx/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,13 +1526,16 @@ def _export(
15261526

15271527
# torch.onnx.export does not support opset versions >=18
15281528
if opset_version > _constants.ONNX_TORCHSCRIPT_EXPORTER_MAX_OPSET:
1529-
raise ValueError(
1529+
# We do not want to fail because we should still allow users to create
1530+
# custom symbolic functions for opset>17
1531+
warnings.warn(
15301532
f"Exporting to ONNX opset version {opset_version} is not supported. "
15311533
f"by 'torch.onnx.export()'. "
15321534
f"The highest opset version supported is {_constants.ONNX_TORCHSCRIPT_EXPORTER_MAX_OPSET}. "
15331535
f"To use a newer opset version, consider 'torch.onnx.dynamo_export()'. "
15341536
f"Note that dynamo_export() is in preview. Please report errors with "
1535-
f"dynamo_export() as Github issues to https://github.com/pytorch/pytorch/issues."
1537+
f"dynamo_export() as Github issues to https://github.com/pytorch/pytorch/issues.",
1538+
category=errors.OnnxExporterWarning,
15361539
)
15371540

15381541
if export_modules_as_functions and opset_version < 15:

0 commit comments

Comments
 (0)
0