Skip to content

[js/web][bugfix] fix negative axes for unsqueeze#11944

Merged
fs-eire merged 1 commit intomicrosoft:masterfrom
Yosshi999:patch-1
Jun 28, 2022
Merged

[js/web][bugfix] fix negative axes for unsqueeze#11944
fs-eire merged 1 commit intomicrosoft:masterfrom
Yosshi999:patch-1

Conversation

@Yosshi999
Copy link
Contributor

Description: Describe your changes.
I fixed the unsqueeze's behavior against negative axis based on the C++ implementation at

axis = HandleNegativeAxis(axis, output_dims.size());

Motivation and Context

When a tensor X has a shape (p, q, r), the result shape of unsqueeze(X, axes=[-1]) must be (p, q, r, 1).
However, the current implementation of onnxruntime-web outputs (p, q, 1, r).

@Yosshi999
Copy link
Contributor Author

Yosshi999 commented Jun 25, 2022

I heard ONNX doesn't support negative axis, but I think buggy implementations can confuse users.

@fs-eire
Copy link
Contributor

fs-eire commented Jun 27, 2022

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux Nuphar CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Jun 27, 2022

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows WebAssembly CI Pipeline, orttraining-amd-gpu-ci-pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed, onnxruntime-python-checks-ci-pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 9 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 8 pipeline(s).

@fs-eire fs-eire merged commit 0702364 into microsoft:master Jun 28, 2022
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this pull request May 9, 2024
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.

2 participants