Fix dimensions for 0D scalars#476
Merged
fdwr merged 12 commits intowebmachinelearning:mainfrom Feb 13, 2024
Merged
Conversation
Collaborator
|
Thanks for spotting / correcting that. |
huningxin
reviewed
Nov 3, 2023
huningxin
reviewed
Nov 7, 2023
Member
|
@fdwr noticed while checking the PR queue this needs a rebase. Good discussion in this PR should be factored in too I believe. |
This was referenced Feb 7, 2024
Closed
Contributor
|
Other things that should be rolled into this PR:
|
Collaborator
Author
|
Build completes now. If I should remove status text containing MLCommandEncoder entirely instead, let me know. |
zolkis
reviewed
Feb 9, 2024
inexorabletash
suggested changes
Feb 9, 2024
zolkis
reviewed
Feb 9, 2024
github-actions bot
added a commit
that referenced
this pull request
Feb 13, 2024
SHA: c320472 Reason: push, by fdwr Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
From issue: #390
A 0D tensor shape vs a 1D tensor with a single element are semantically and functionally distinct, but the current spec mistreats 0D scalars and 1D tensors like they are the same thing, and this messes with the shape inference for operators like
reduceSum(with all axes andkeepDimensions = false) orgatherwhere the output rank depends on the correct rank for input and indices tensors. This caused models like Segment Anything and Stable Diffusion to fail while prototyping, and the issue arose again during Chromium and ORT WebNN EP code review.[1,2,3]- 3D tensor shape[1,2]- 2D tensor shape[1]- 1D tensor shape[]- 0D tensor shape (scalar) <--- (every known ML library represents 0D scalars via the shape[])Fixing this in the Chromium fork needed changing just two lines, and we want to address this sooner than later before changing just a few lines becomes multiple lines.
Preview | Diff