Skip to content

[WIP] Squeeze node fails when axes is "" #25063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 14, 2025

  • Understand the issue: Squeeze node fails when axes is empty string ("") instead of omitted
  • Explore codebase and identify affected providers (CUDA, CPU, JS, WebGPU)
  • Create test cases to reproduce the issue
  • Fix CUDA provider (main issue)
  • Fix CPU provider
  • Fix JS provider
  • Fix WebGPU provider
  • Fix Unsqueeze operator with same issue
  • Build and test the changes
  • Ensure all existing tests still pass

Fixed the issue where Squeeze and Unsqueeze nodes fail when the optional axes input is provided as empty string (""). According to ONNX spec, this should be treated as "no axes provided".

Changes:

  • Modified all Squeeze providers (CUDA, CPU, JS, WebGPU) to check if axes tensor is null or empty
  • Applied same fix to Unsqueeze operators
  • Added test cases to verify the fix works correctly
  • When axes tensor is null or has size 0, fall back to using attribute axes or default behavior

Fixes #21661.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

You can commit the suggested changes from lintrunner.

Comment on lines +394 to +396

// Test for null axes tensor - this should behave the same as no axes provided
TEST(SqueezeOpTest, Squeeze_Null_Axes_Input) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Test for null axes tensor - this should behave the same as no axes provided
TEST(SqueezeOpTest, Squeeze_Null_Axes_Input) {
// Test for null axes tensor - this should behave the same as no axes provided
TEST(SqueezeOpTest, Squeeze_Null_Axes_Input) {

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.

Squeeze node fails when axes is ""
2 participants