-
Notifications
You must be signed in to change notification settings - Fork 363
docs: A tutorial on how to overload converters in Torch-TensorRT #3197
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
Conversation
8a91949
to
421e671
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
# %% 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as an activation layer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am -> an
# | ||
# 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Canidate -> Candidate
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
421e671
to
3ed806f
Compare
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: