Add FlattenAndUnpad Op - #17845
Merged
Merged
Conversation
pengwa
reviewed
Oct 9, 2023
pengwa
reviewed
Oct 9, 2023
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
2 times, most recently
from
October 10, 2023 12:20
89c157e to
cbf9348
Compare
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
from
October 11, 2023 06:26
cbf9348 to
69db77a
Compare
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
from
October 12, 2023 07:25
69db77a to
ec58f22
Compare
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
from
October 12, 2023 07:41
ec58f22 to
2003901
Compare
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
from
November 7, 2023 05:17
2003901 to
ba4fa1e
Compare
pengwa
reviewed
Nov 7, 2023
pengwa
reviewed
Nov 7, 2023
pengwa
reviewed
Nov 7, 2023
pengwa
reviewed
Nov 7, 2023
pengwa
reviewed
Nov 7, 2023
pengwa
reviewed
Nov 7, 2023
Contributor
|
Do you have perf improvement numbers to share in the PR description? |
pengwa
reviewed
Nov 7, 2023
pengwa
previously approved these changes
Nov 7, 2023
pengwa
approved these changes
Nov 8, 2023
pengwa
reviewed
Nov 8, 2023
pengwa
reviewed
Nov 8, 2023
kleiti
pushed a commit
to kleiti/onnxruntime
that referenced
this pull request
Mar 22, 2024
### Description Add an op named `FlattenAndUnpad`. This op implements functions: 1. Flatten the first two dims of input tensor. 2. Gather valid value from input tensor with index tensor,. ### Motivation and Context The grad op of `PadAndUnflatten` was `GatherGrad` which is inefficient in performance. I implement this `FlattenAndUnpad` just to replace the `GatherGrad` as grad of `PadAndUnflatten`. With this op, we also can simplify the "Reshape + ShrunkenGather" pattern to `PadAndUnflatten` in padding elimination optimizer, which will also improve performance.
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
Add an op named
FlattenAndUnpad.This op implements functions:
Motivation and Context
The grad op of
PadAndUnflattenwasGatherGradwhich is inefficient in performance.I implement this
FlattenAndUnpadjust to replace theGatherGradas grad ofPadAndUnflatten.With this op, we also can simplify the "Reshape + ShrunkenGather" pattern to
PadAndUnflattenin padding elimination optimizer, which will also improve performance.