Skip to content

Commit ba2439e

Browse files
authored
Merge branch 'main' into fix-2219-new
2 parents 7a2ac23 + 3364ada commit ba2439e

7 files changed

Lines changed: 120 additions & 14 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ jobs:
4141

4242
steps:
4343
- name: Checkout repository
44-
uses: actions/checkout@v5
44+
uses: actions/checkout@v6
4545

4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@v3
48+
uses: github/codeql-action/init@v4
4949
with:
5050
languages: ${{ matrix.language }}
5151
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -59,7 +59,7 @@ jobs:
5959
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6060
# If this step fails, then you should remove it and run the build manually (see below)
6161
- name: Autobuild
62-
uses: github/codeql-action/autobuild@v3
62+
uses: github/codeql-action/autobuild@v4
6363

6464
# ℹ️ Command-line programs to run using the OS shell.
6565
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# ./location_of_script_within_repo/buildscript.sh
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@v3
75+
uses: github/codeql-action/analyze@v4

.github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
pull-requests: write
2121

2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2424
- name: misspell # Check spelling
2525
uses: reviewdog/action-misspell@v1
2626
with:
@@ -43,7 +43,7 @@ jobs:
4343
permissions:
4444
security-events: write
4545
steps:
46-
- uses: actions/checkout@v5
46+
- uses: actions/checkout@v6
4747
- name: Setup Python
4848
uses: actions/setup-python@v6
4949
with:
@@ -78,7 +78,7 @@ jobs:
7878
# To toggle linter comments in the files page, press `i` on the keyboard
7979
if: always()
8080
continue-on-error: true
81-
uses: github/codeql-action/upload-sarif@v3
81+
uses: github/codeql-action/upload-sarif@v4
8282
with:
8383
# Path to SARIF file relative to the root of the repository
8484
sarif_file: lintrunner.sarif

.github/workflows/main.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
nox-tag: test-onnx-ir-git
5858
runs-on: ${{ matrix.os }}
5959
steps:
60-
- uses: actions/checkout@v5
60+
- uses: actions/checkout@v6
6161
- name: Setup Python ${{ matrix.python-version }}
6262
uses: actions/setup-python@v6
6363
with:
@@ -95,7 +95,7 @@ jobs:
9595
os: [ubuntu-latest, windows-latest]
9696
runs-on: ${{ matrix.os }}
9797
steps:
98-
- uses: actions/checkout@v5
98+
- uses: actions/checkout@v6
9999
- name: Setup Python
100100
uses: actions/setup-python@v6
101101
with:
@@ -119,7 +119,7 @@ jobs:
119119
update_readme:
120120
runs-on: ubuntu-latest
121121
steps:
122-
- uses: actions/checkout@v5
122+
- uses: actions/checkout@v6
123123
- name: Setup Python
124124
uses: actions/setup-python@v6
125125
- name: Update readme

.github/workflows/pages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v5
28+
uses: actions/checkout@v6
2929
- name: Setup Pages
3030
uses: actions/configure-pages@v4
3131
- name: Setup Python
3232
uses: actions/setup-python@v6
3333
with:
3434
python-version: "3.10"
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636
- name: Install dependencies
3737
run: |
3838
python -m pip install --upgrade pip setuptools wheel
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# https://aiinfra.visualstudio.com/PublicPackages/_artifacts/feed/ORT-Nightly/PyPI/onnxruntime/overview
22
--index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/
3-
onnxruntime==1.23.1
3+
onnxruntime==1.23.2

requirements/lintrunner/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is auto updated by dependabot
22
lintrunner-adapters>=0.8.0
33
# RUFF, RUFF-FIX
4-
ruff==0.14.3
4+
ruff==0.14.6
55
# MYPY
66
mypy==1.10.1
77
types-PyYAML==6.0.12.20250915

tests/function_libs/torch_lib/e2e_ops_tests.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,112 @@ def forward(self, x):
520520
)
521521
_testing.assert_onnx_program(onnx_program)
522522

523+
def test_unbind_dim0(self):
524+
"""Test unbind along dimension 0"""
525+
526+
class UnbindModel(torch.nn.Module):
527+
def forward(self, x):
528+
tensors = torch.unbind(x, dim=0)
529+
return sum(tensors)
530+
531+
model = UnbindModel()
532+
x = torch.randn(3, 4, 5)
533+
onnx_program = torch.onnx.export(model, (x,), dynamo=True, verbose=False)
534+
_testing.assert_onnx_program(onnx_program)
535+
536+
def test_unbind_dim1(self):
537+
"""Test unbind along dimension 1"""
538+
539+
class UnbindModel(torch.nn.Module):
540+
def forward(self, x):
541+
tensors = torch.unbind(x, dim=1)
542+
return sum(tensors)
543+
544+
model = UnbindModel()
545+
x = torch.randn(2, 3, 4)
546+
onnx_program = torch.onnx.export(model, (x,), dynamo=True, verbose=False)
547+
_testing.assert_onnx_program(onnx_program)
548+
549+
def test_unbind_negative_dim(self):
550+
"""Test unbind with negative dimension"""
551+
552+
class UnbindModel(torch.nn.Module):
553+
def forward(self, x):
554+
tensors = torch.unbind(x, dim=-1)
555+
return sum(tensors)
556+
557+
model = UnbindModel()
558+
x = torch.randn(2, 3, 4)
559+
onnx_program = torch.onnx.export(model, (x,), dynamo=True, verbose=False)
560+
_testing.assert_onnx_program(onnx_program)
561+
562+
def test_unbind_size_one(self):
563+
"""Test unbind with dimension of size 1"""
564+
565+
class UnbindModel(torch.nn.Module):
566+
def forward(self, x):
567+
tensors = torch.unbind(x, dim=0)
568+
return tensors[0]
569+
570+
model = UnbindModel()
571+
x = torch.randn(1, 4, 5)
572+
onnx_program = torch.onnx.export(model, (x,), dynamo=True, verbose=False)
573+
_testing.assert_onnx_program(onnx_program)
574+
575+
def test_unbind_with_lstm(self):
576+
"""Test unbind in LSTM context"""
577+
578+
class LSTMDecoder(torch.nn.Module):
579+
def __init__(self):
580+
super().__init__()
581+
self.embedding = torch.nn.Embedding(100, 64)
582+
self.lstm = torch.nn.LSTM(64, 64, 2, batch_first=True) # 2 layers
583+
self.fc = torch.nn.Linear(64, 100)
584+
585+
def forward(self, tokens, h, c):
586+
embedded = self.embedding(tokens).unsqueeze(0)
587+
output, (h_out, c_out) = self.lstm(embedded, (h, c))
588+
logits = self.fc(output.squeeze(0).squeeze(0))
589+
return logits, h_out, c_out
590+
591+
model = LSTMDecoder()
592+
model.eval()
593+
tokens = torch.tensor([1])
594+
h = torch.randn(2, 1, 64) # 2 layers
595+
c = torch.randn(2, 1, 64) # 2 layers
596+
onnx_program = torch.onnx.export(model, (tokens, h, c), dynamo=True, verbose=False)
597+
_testing.assert_onnx_program(onnx_program)
598+
599+
def test_unbind_dynamic_dim0(self):
600+
"""Test unbind with dynamic dimension 0 - triggers SplitToSequence"""
601+
602+
class UnbindModel(torch.nn.Module):
603+
def forward(self, x):
604+
tensors = torch.unbind(x, dim=0)
605+
return sum(tensors)
606+
607+
model = UnbindModel()
608+
x = torch.randn(3, 4, 5)
609+
onnx_program = torch.onnx.export(
610+
model, (x,), dynamo=True, verbose=False, dynamic_shapes=({0: "batch_size"},)
611+
)
612+
_testing.assert_onnx_program(onnx_program)
613+
614+
def test_unbind_dynamic_dim1(self):
615+
"""Test unbind with dynamic dimension 1 - triggers SplitToSequence"""
616+
617+
class UnbindModel(torch.nn.Module):
618+
def forward(self, x):
619+
tensors = torch.unbind(x, dim=1)
620+
return sum(tensors)
621+
622+
model = UnbindModel()
623+
x = torch.randn(2, 3, 4)
624+
onnx_program = torch.onnx.export(
625+
model, (x,), dynamo=True, verbose=False, dynamic_shapes=({1: "seq_len"},)
626+
)
627+
_testing.assert_onnx_program(onnx_program)
628+
523629

524630
if __name__ == "__main__":
525631
unittest.main()

0 commit comments

Comments
 (0)