Skip to content

Conversation

@tgolsson
Copy link
Contributor

Per the spec, these two fields should be 1D-tensors:

  • starts (heterogeneous) - Tind:
    1-D tensor of starting indices of corresponding axis in axes

  • ends (heterogeneous) - Tind:
    1-D tensor of ending indices (exclusive) of corresponding axis in axes

With the original code; the output is like this when printing the graph:

   <snip> int64 val_1 =  {1}, int64 val_3 =  {0}, <snip>

   [node_Slice_5] val_5 = Slice (transpose_1, val_3, val_1, val_4)
   [node_Slice_6] val_6 = Slice (transpose_2, val_3, val_1, val_4)

With the changes:

   <snip> int64[1] val_3 =  {0}, int64[1] val_4 =  {1}, <snip>

   [node_Slice_5] val_5 = Slice (transpose_1, val_3, val_4, val_3)
   [node_Slice_6] val_6 = Slice (transpose_2, val_3, val_4, val_3)

This being scalar was seemingly accepted by the ONNX reference evaluator and potentially other runtimes, but not in tract.

Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

Thanks for the catch

@justinchuby justinchuby changed the title aten_{lstm,gru}: slice hidden/cell state with sequence Fix {lstm,gru}: slice hidden/cell state with sequence Feb 10, 2026
@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Feb 10, 2026
@justinchuby justinchuby enabled auto-merge (squash) February 10, 2026 16:12
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.51%. Comparing base (5ae26d9) to head (a18533f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnxscript/function_libs/torch_lib/ops/core.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2803   +/-   ##
=======================================
  Coverage   70.51%   70.51%           
=======================================
  Files         228      228           
  Lines       27214    27214           
  Branches     2737     2737           
=======================================
  Hits        19189    19189           
  Misses       7090     7090           
  Partials      935      935           

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

@justinchuby justinchuby merged commit 83df7df into microsoft:main Feb 10, 2026
31 of 32 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.

2 participants