:orphan:

.. _torch_tensorrt_tutorials:

Torch-TensorRT Tutorials
===========================

The user guide covers the basic concepts and usage of Torch-TensorRT.
We also provide a number of tutorials to explore specific usecases and advanced concepts



.. raw:: html

    <div class="sphx-glr-thumbnails">


.. raw:: html

    </div>


Dynamo / ``torch.compile``
----------------------------

Torch-TensorRT provides a backend for the new ``torch.compile`` API released in PyTorch 2.0. In the following examples we describe
a number of ways you can leverage this backend to accelerate inference.

* :ref:`dynamo_compile_resnet`: Compiling a ResNet model using the Dyanmo Compile Frontend for ``torch_tensorrt.compile``
* :ref:`torch_compile_transformer`: Compiling a Transformer model using ``torch.compile``
* :ref:`dynamo_compile_advanced_usage`: Advanced usage including making a custom backend to use directly with the ``torch.compile`` API



.. raw:: html

    <div class="sphx-glr-thumbnails">


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This interactive script is intended as a sample of the torch_tensorrt.dynamo.compile workflow o...">

.. only:: html

  .. image:: /tutorials/_rendered_examples/dynamo/images/thumb/sphx_glr_dynamo_compile_resnet_example_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials__rendered_examples_dynamo_dynamo_compile_resnet_example.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Compiling ResNet using the Torch-TensorRT Dyanmo Frontend</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This interactive script is intended as a sample of the torch_tensorrt.dynamo.compile workflow o...">

.. only:: html

  .. image:: /tutorials/_rendered_examples/dynamo/images/thumb/sphx_glr_dynamo_compile_transformers_example_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials__rendered_examples_dynamo_dynamo_compile_transformers_example.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Compiling a Transformer using torch.compile and TensorRT</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This interactive script is intended as an overview of the process by which torch_tensorrt.dynam...">

.. only:: html

  .. image:: /tutorials/_rendered_examples/dynamo/images/thumb/sphx_glr_dynamo_compile_advanced_usage_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials__rendered_examples_dynamo_dynamo_compile_advanced_usage.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Dynamo Compile Advanced Usage</div>
    </div>


.. raw:: html

    </div>


.. toctree::
   :hidden:
   :includehidden:


   /tutorials/_rendered_examples//dynamo/index.rst


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download all examples in Python source code: _rendered_examples_python.zip </tutorials/_rendered_examples/_rendered_examples_python.zip>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download all examples in Jupyter notebooks: _rendered_examples_jupyter.zip </tutorials/_rendered_examples/_rendered_examples_jupyter.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
