[js/web][bugfix] fix negative axes for unsqueeze#11944
Merged
fs-eire merged 1 commit intomicrosoft:masterfrom Jun 28, 2022
Merged
[js/web][bugfix] fix negative axes for unsqueeze#11944fs-eire merged 1 commit intomicrosoft:masterfrom
fs-eire merged 1 commit intomicrosoft:masterfrom
Conversation
Contributor
Author
|
I heard ONNX doesn't support negative axis, but I think buggy implementations can confuse users. |
fs-eire
approved these changes
Jun 27, 2022
Contributor
|
/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 |
Contributor
|
/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 successfully started running 9 pipeline(s). |
|
Azure Pipelines successfully started running 8 pipeline(s). |
siweic0
pushed a commit
to siweic0/onnxruntime-web
that referenced
this pull request
May 9, 2024
[js/web] fix negative axes for unsqueeze
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: Describe your changes.
I fixed the unsqueeze's behavior against negative axis based on the C++ implementation at
onnxruntime/onnxruntime/core/providers/cpu/tensor/unsqueeze.cc
Line 65 in 7e092a7
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).