Skip to content

[Fix] nn.attention support dynamic batch_size#19779

Merged
tlopex merged 1 commit into
apache:mainfrom
flashmouse:issue-19696
Jun 15, 2026
Merged

[Fix] nn.attention support dynamic batch_size#19779
tlopex merged 1 commit into
apache:mainfrom
flashmouse:issue-19696

Conversation

@flashmouse

Copy link
Copy Markdown
Contributor

This PR try to fix #19696 , nn.attention support dynamic batch_size

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue with dynamic batch sizes in the attention operator legalization by explicitly specifying the output shape (oshape) in topi.nn.batch_matmul calls. It also introduces a pre-calculated batch size variable bs to simplify the code and adds a new unit test to verify legalization with dynamic batch dimensions. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@tlopex tlopex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM Thanks for the fix!

@tlopex tlopex merged commit 2410c50 into apache:main Jun 15, 2026
9 checks passed
MasterJH5574 pushed a commit that referenced this pull request Jun 16, 2026
This PR try to fix #19696 , ``nn.attention`` support dynamic batch_size

Co-authored-by: flashmouse <flashmosue2012@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Relax] nn.attention fails to legalize when batch dim is a symbolic tirx.Var

2 participants