Skip to content

Fix Attention 3D, reference implementation and c++ expansion#7142

Merged
justinchuby merged 18 commits intoonnx:mainfrom
xadupre:att3d
Jul 17, 2025
Merged

Fix Attention 3D, reference implementation and c++ expansion#7142
justinchuby merged 18 commits intoonnx:mainfrom
xadupre:att3d

Conversation

@xadupre
Copy link
Copy Markdown
Contributor

@xadupre xadupre commented Jul 17, 2025

Description

Replaces #7129. Fixes #7118.

It does:

  • fixes class Attention in onnx.reference.ops.op_attention
  • fixes expanded C++ function in onnx/defs/nn/defs.cc
  • adds example using float16 and with 4D masks

Copilot AI and others added 15 commits July 16, 2025 14:57
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: xadupre <xadupre@microsoft.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 13.69863% with 63 lines in your changes missing coverage. Please review.

Project coverage is 53.64%. Comparing base (a0722c3) to head (4597778).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnx/backend/test/case/node/attention.py 0.00% 63 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7142      +/-   ##
==========================================
- Coverage   53.74%   53.64%   -0.11%     
==========================================
  Files         508      508              
  Lines       32108    32174      +66     
  Branches     2969     2970       +1     
==========================================
+ Hits        17257    17260       +3     
- Misses      14055    14118      +63     
  Partials      796      796              

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

Signed-off-by: xadupre <xadupre@microsoft.com>
Comment thread onnx/reference/ops/op_trilu.py Outdated
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Comment thread onnx/reference/ops/op_trilu.py Fixed
Signed-off-by: xadupre <xadupre@microsoft.com>
@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in PR Tracker Jul 17, 2025
@justinchuby justinchuby merged commit b9a3100 into onnx:main Jul 17, 2025
38 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in PR Tracker Jul 17, 2025
xadupre added a commit to microsoft/onnxruntime that referenced this pull request Jul 25, 2025
### Description
Implementation Attention(23) for CPU.

The backend tests from onnx were wrong for Attention (see
onnx/onnx#7142). The onnx version needs to be
updated to make all tests pass. The implementation matches the reference
implementation after onnx was fixed.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ti-Tai Wang <titaiwang@microsoft.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
RyanMetcalfeInt8 pushed a commit to RyanMetcalfeInt8/onnxruntime that referenced this pull request Jul 29, 2025
### Description
Implementation Attention(23) for CPU.

The backend tests from onnx were wrong for Attention (see
onnx/onnx#7142). The onnx version needs to be
updated to make all tests pass. The implementation matches the reference
implementation after onnx was fixed.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ti-Tai Wang <titaiwang@microsoft.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
MagellaX pushed a commit to MagellaX/onnx that referenced this pull request Aug 9, 2025
### Description

Replaces onnx#7129. Fixes issue onnx#7118.

It does:

* fixes class Attention in onnx.reference.ops.op_attention
* fixes expanded C++ function in onnx/defs/nn/defs.cc
* adds example using float16 and with 4D masks

---------

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: xadupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Signed-off-by: Yash solanki <alphacr792@gmail.com>
sanketkaleoss pushed a commit to sanketkaleoss/onnxruntime that referenced this pull request Aug 11, 2025
### Description
Implementation Attention(23) for CPU.

The backend tests from onnx were wrong for Attention (see
onnx/onnx#7142). The onnx version needs to be
updated to make all tests pass. The implementation matches the reference
implementation after onnx was fixed.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ti-Tai Wang <titaiwang@microsoft.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ONNX][Attention]the reference missed Transpose for 3D attention

5 participants