docs: A tutorial on how to overload converters in Torch-TensorRT#3197
Merged
narendasan merged 1 commit intomainfrom Oct 1, 2024
Merged
docs: A tutorial on how to overload converters in Torch-TensorRT#3197narendasan merged 1 commit intomainfrom
narendasan merged 1 commit intomainfrom
Conversation
8a91949 to
421e671
Compare
peri044
reviewed
Oct 1, 2024
| # %% GeLU Operator in PyTorch | ||
| # | ||
| # GeLU has 2 modes in PyTorch, one using the ``erf`` function and the other using the ``tanh`` approximation. | ||
| # TensorRT natively supports both implementations as am activation layer, but suppose we want to use a custom implementation of GeLU in TensorRT only for ``tanh`` mode. |
Collaborator
There was a problem hiding this comment.
nit: as an activation layer
zewenli98
reviewed
Oct 1, 2024
Collaborator
zewenli98
left a comment
There was a problem hiding this comment.
Overall LGTM, just some minor comments.
| # %% GeLU Operator in PyTorch | ||
| # | ||
| # GeLU has 2 modes in PyTorch, one using the ``erf`` function and the other using the ``tanh`` approximation. | ||
| # TensorRT natively supports both implementations as am activation layer, but suppose we want to use a custom implementation of GeLU in TensorRT only for ``tanh`` mode. |
| # | ||
| # Finally there is the ``priority`` argument, which is an enum from the ``torch_tensorrt.dynamo.conversion.ConverterPriority`` class that defines the priority of the converter. The two options are ``HIGH`` and ``STANDARD``. | ||
| # Converters registered with ``STANDARD`` will be appended to the converter list for a given operation, while converters registered with ``HIGH`` will be prepended to the list. | ||
| # Canidate converters are evalated for their suitablity in this priority order and the first converter that passes the validator is used. |
Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
421e671 to
3ed806f
Compare
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
Small tutorial on how to overload converters in Torch-TensorRT
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: