Add Torch 2.10 with updated Torch and torchvision versions (#23808)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2026-03-06 00:01:35 +01:00 committed by GitHub
parent 1ce3b0c4e6
commit 381401e8af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -288,6 +288,10 @@ jobs:
python: "3.12"
torch: "2.9.0"
torchvision: "0.24.0"
- os: ubuntu-latest
python: "3.12"
torch: "2.10.0"
torchvision: "0.25.0"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6

View File

@ -187,6 +187,8 @@ def best_onnx_opset(onnx, cuda=False) -> int:
"""Return max ONNX opset for this torch version with ONNX fallback."""
if TORCH_2_4: # _constants.ONNX_MAX_OPSET first defined in torch 1.13
opset = torch.onnx.utils._constants.ONNX_MAX_OPSET - 1 # use second-latest version for safety
if TORCH_2_9:
opset = min(opset, 20) # legacy TorchScript exporter caps at opset 20 in torch 2.9+
if cuda:
opset -= 2 # fix CUDA ONNXRuntime NMS squeeze op errors
else: