-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add FlattenAndUnpad Op #17845
Merged
Merged
Add FlattenAndUnpad Op #17845
Conversation
This file contains 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
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
pengwa
added
the
training
issues related to ONNX Runtime training; typically submitted using template
label
Oct 11, 2023
guyang3532
force-pushed
the
yangu/flatten_and_unpad
branch
from
October 11, 2023 06:26
cbf9348
to
69db77a
Compare
orttraining/orttraining/test/training_ops/cuda/flatten_and_unpad_test.cc
Fixed
Show fixed
Hide fixed
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
orttraining/orttraining/test/training_ops/cuda/flatten_and_unpad_test.cc
Outdated
Show resolved
Hide resolved
pengwa
reviewed
Nov 7, 2023
orttraining/orttraining/test/training_ops/cuda/flatten_and_unpad_test.cc
Outdated
Show resolved
Hide resolved
pengwa
reviewed
Nov 7, 2023
orttraining/orttraining/training_ops/rocm/rocm_training_kernels.cc
Outdated
Show resolved
Hide resolved
orttraining/orttraining/training_ops/cuda/tensor/flatten_and_unpad_impl.cu
Outdated
Show resolved
Hide resolved
pengwa
reviewed
Nov 7, 2023
Do you have perf improvement numbers to share in the PR description? |
pengwa
reviewed
Nov 7, 2023
orttraining/orttraining/training_ops/cuda/tensor/flatten_and_unpad_impl.cu
Outdated
Show resolved
Hide resolved
pengwa
previously approved these changes
Nov 7, 2023
pengwa
approved these changes
Nov 8, 2023
pengwa
reviewed
Nov 8, 2023
orttraining/orttraining/training_ops/cuda/tensor/pad_and_unflatten_impl.cu
Show resolved
Hide resolved
pengwa
reviewed
Nov 8, 2023
orttraining/orttraining/training_ops/cuda/tensor/flatten_and_unpad_impl.cu
Show resolved
Hide resolved
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.
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
PadAndUnflatten
wasGatherGrad
which is inefficient in performance.I implement this
FlattenAndUnpad
just to replace theGatherGrad
as grad ofPadAndUnflatten
.With this op, we also can simplify the "Reshape + ShrunkenGather" pattern to
PadAndUnflatten
in padding elimination optimizer, which will also improve performance.