Skip to content

Fix invalid ONNX graph from None start/end in aten_slice_scatter - #3006

Merged
Justin Chu (justinchuby) merged 2 commits into
microsoft:mainfrom
gabrielfruet:fix/slice-scatter-none-bounds
Aug 21, 2026
Merged

Fix invalid ONNX graph from None start/end in aten_slice_scatter#3006
Justin Chu (justinchuby) merged 2 commits into
microsoft:mainfrom
gabrielfruet:fix/slice-scatter-none-bounds

Conversation

@gabrielfruet

Copy link
Copy Markdown
Contributor

aten::slice_scatter produced an invalid ONNX graph whenever start or end came in as None. The lowering unsqueezed both bounds unconditionally, so a None turned into an empty-string input to Unsqueeze. A missing start now defaults to 0 and a missing end to INT64_MAX, a full slice, matching what aten_slice already does.

Changes:

  • torch_lib/ops/core.py: build the Slice bounds conditionally, unsqueezing start or end only when they are provided.
  • tests/function_libs/torch_lib/extra_opinfo.py: regression sample-input cases for None start, None end, both, and a step-2 variant.

Testing: the existing slice_scatter OpInfo suite now exercises the None bounds.

Fixes #2372

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gabrielfruet
fruet (gabrielfruet) marked this pull request as ready for review August 21, 2026 21:30
@gabrielfruet

Copy link
Copy Markdown
Contributor Author

Justin Chu (@justinchuby) Do you mind taking a look?

@justinchuby Justin Chu (justinchuby) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@justinchuby
Justin Chu (justinchuby) enabled auto-merge (squash) August 21, 2026 23:03
@justinchuby Justin Chu (justinchuby) added the module: torchlib Related to the torch/aten function lib in development label Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.63%. Comparing base (9ef0aac) to head (36fa482).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3006   +/-   ##
=======================================
  Coverage   72.63%   72.63%           
=======================================
  Files         265      265           
  Lines       32204    32210    +6     
  Branches     3041     3042    +1     
=======================================
+ Hits        23391    23397    +6     
  Misses       7779     7779           
  Partials     1034     1034           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@justinchuby
Justin Chu (justinchuby) merged commit a39c0a5 into microsoft:main Aug 21, 2026
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: torchlib Related to the torch/aten function lib in development

Projects

Development

Successfully merging this pull request may close these issues.

[torchlib] slice_scatter does not support start and end to be None

2 participants