Skip to content

Commit 60f2d18

Browse files
committed
docs: Document the tuple lowering pass
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent ee727f8 commit 60f2d18

File tree

6 files changed

+80
-4
lines changed

6 files changed

+80
-4
lines changed

docs/_sources/contributors/lowering.rst.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ all attributes accesses are replaced with explicit inputs of the graph
8484
graph are the trainable parameters used in this method. The remaining inputs
8585
are the true inputs to the function.
8686

87+
Lower Tuples
88+
***************************************
89+
90+
`torch/csrc/jit/passes/lower_tuples.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/lower_tuples.h>`_
91+
92+
* ``LowerSimpleTuples``:
93+
94+
Removes tuples where TupleConstruct and TupleUnpack are matched but leaves tuples in place across if statements, loops, and as inputs/outputs
95+
96+
* ``LowerAllTuples``:
97+
98+
Removes _all_ tuples and raises an error if some cannot be removed, this is used by ONNX to ensure there are not tuples before conversion, but will not work on graphs whose inputs contain tuples.
99+
87100
Remove Dropout
88101
***************************************
89102

docs/contributors/lowering.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@
522522
Lower Graph
523523
</a>
524524
</li>
525+
<li class="md-nav__item">
526+
<a class="md-nav__link" href="#lower-tuples">
527+
Lower Tuples
528+
</a>
529+
</li>
525530
<li class="md-nav__item">
526531
<a class="md-nav__link" href="#remove-dropout">
527532
Remove Dropout
@@ -764,6 +769,51 @@ <h3 id="lower-graph">
764769
graph are the trainable parameters used in this method. The remaining inputs
765770
are the true inputs to the function.
766771
</p>
772+
<h3 id="lower-tuples">
773+
Lower Tuples
774+
<a class="headerlink" href="#lower-tuples" title="Permalink to this headline">
775+
776+
</a>
777+
</h3>
778+
<blockquote>
779+
<div>
780+
<p>
781+
<a class="reference external" href="https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/lower_tuples.h">
782+
torch/csrc/jit/passes/lower_tuples.h
783+
</a>
784+
</p>
785+
</div>
786+
</blockquote>
787+
<ul class="simple">
788+
<li>
789+
<p>
790+
<code class="docutils literal notranslate">
791+
<span class="pre">
792+
LowerSimpleTuples
793+
</span>
794+
</code>
795+
:
796+
</p>
797+
</li>
798+
</ul>
799+
<p>
800+
Removes tuples where TupleConstruct and TupleUnpack are matched but leaves tuples in place across if statements, loops, and as inputs/outputs
801+
</p>
802+
<ul class="simple">
803+
<li>
804+
<p>
805+
<code class="docutils literal notranslate">
806+
<span class="pre">
807+
LowerAllTuples
808+
</span>
809+
</code>
810+
:
811+
</p>
812+
</li>
813+
</ul>
814+
<p>
815+
Removes _all_ tuples and raises an error if some cannot be removed, this is used by ONNX to ensure there are not tuples before conversion, but will not work on graphs whose inputs contain tuples.
816+
</p>
767817
<h3 id="remove-dropout">
768818
Remove Dropout
769819
<a class="headerlink" href="#remove-dropout" title="Permalink to this headline">

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/sitemap.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/class_view_hierarchy.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ExtraInfo_1_1DataType.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ExtraInfo_1_1DeviceType.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ptq_1_1Int8CacheCalibrator.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ptq_1_1Int8Calibrator.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a18d295a837ac71add5578860b55e5502.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a20c1fbeb21757871c52299dc52351b5f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a25ee153c325dfc7466a33cbd5c1ff055.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a48d6029a45583a06848891cb0e86f7ba.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a71b02dddfabe869498ad5a88e11c440f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a9d31d0569348d109b1b069b972dd143e.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1abe87b341f562fd1cf40b7672e4d759da.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1ae1c56ab8a40af292a9a4964651524d84.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api_include.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api_include_trtorch.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/enum_logging_8h_1a5f612ff2f783ff4fbe89d168f0d817d4.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_logging.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_macros.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_ptq.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_trtorch.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_view_hierarchy.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a118d65b179defff7fff279eb9cd126cb.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a396a688110397538f8b3fb7dfdaf38bb.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a9b420280bfacc016d7e36a5704021949.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1aa533955a2b908db9e5df5acdfa24715f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1abc57d473f3af292551dee8b9c78373ad.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1adf5435f0dbb09c0d931a1b851847236b.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1aef44b69c62af7cf2edc8875a9506641a.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a2cf17d43ba9117b3b4d652744b4f0447.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a4422781719d7befedb364cacd91c6247.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a536bba54b70e44554099d23fa3d7e804.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a5f33b142bc2f3f2aaf462270b3ad7e31.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a726f6e7091b6b7be45b5a4275b2ffb10.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1ab01696cfe08b6a5293c55935a9713c25.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1ae38897d1ca4438227c970029d0f76fb5.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch__logging.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch__ptq.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_logging.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_macros.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_ptq.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_trtorch.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/structtrtorch_1_1ExtraInfo.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/structtrtorch_1_1ExtraInfo_1_1InputRange.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/trtorch_cpp.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/unabridged_api.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/unabridged_orphan.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/index.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/tutorials/installation.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/genindex.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/py-modindex.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/search.html</loc></url></urlset>
1+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/class_view_hierarchy.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ExtraInfo_1_1DataType.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ExtraInfo_1_1DeviceType.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ptq_1_1Int8CacheCalibrator.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/classtrtorch_1_1ptq_1_1Int8Calibrator.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a18d295a837ac71add5578860b55e5502.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a20c1fbeb21757871c52299dc52351b5f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a25ee153c325dfc7466a33cbd5c1ff055.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a48d6029a45583a06848891cb0e86f7ba.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a71b02dddfabe869498ad5a88e11c440f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1a9d31d0569348d109b1b069b972dd143e.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1abe87b341f562fd1cf40b7672e4d759da.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/define_macros_8h_1ae1c56ab8a40af292a9a4964651524d84.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api_include.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/dir_cpp_api_include_trtorch.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/enum_logging_8h_1a5f612ff2f783ff4fbe89d168f0d817d4.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_logging.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_macros.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_ptq.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_cpp_api_include_trtorch_trtorch.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/file_view_hierarchy.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a118d65b179defff7fff279eb9cd126cb.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a396a688110397538f8b3fb7dfdaf38bb.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1a9b420280bfacc016d7e36a5704021949.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1aa533955a2b908db9e5df5acdfa24715f.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1abc57d473f3af292551dee8b9c78373ad.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1adf5435f0dbb09c0d931a1b851847236b.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_logging_8h_1aef44b69c62af7cf2edc8875a9506641a.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a2cf17d43ba9117b3b4d652744b4f0447.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a4422781719d7befedb364cacd91c6247.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a536bba54b70e44554099d23fa3d7e804.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a5f33b142bc2f3f2aaf462270b3ad7e31.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1a726f6e7091b6b7be45b5a4275b2ffb10.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1ab01696cfe08b6a5293c55935a9713c25.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/function_trtorch_8h_1ae38897d1ca4438227c970029d0f76fb5.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch__logging.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/namespace_trtorch__ptq.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_logging.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_macros.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_ptq.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/program_listing_file_cpp_api_include_trtorch_trtorch.h.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/structtrtorch_1_1ExtraInfo.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/structtrtorch_1_1ExtraInfo_1_1InputRange.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/trtorch_cpp.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/unabridged_api.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/_cpp_api/unabridged_orphan.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/contributors/lowering.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/contributors/phases.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/contributors/system_overview.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/contributors/useful_links.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/index.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/py_api/logging.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/py_api/trtorch.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/tutorials/getting_started.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/tutorials/installation.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/genindex.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/py-modindex.html</loc></url><url><loc>https://nvidia.github.io/TRTorch/search.html</loc></url></urlset>

docs/tutorials/getting_started.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,10 @@ <h2 id="working-with-torchscript-in-c">
937937
<span class="cp">#include</span> <span class="cpf">&lt;memory&gt;</span><span class="cp"></span>
938938

939939
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
940-
<span class="n">torch</span><span class="o">::</span><span class="n">jit</span><span class="o">::</span><span class="n">Module</span> <span class="n">module</span><span class="p">;</span>
940+
<span class="n">torch</span><span class="o">::</span><span class="n">jit</span><span class="o">::</span><span class="n">Module</span> <span class="k">module</span><span class="p">;</span>
941941
<span class="k">try</span> <span class="p">{</span>
942942
<span class="c1">// Deserialize the ScriptModule from a file using torch::jit::load().</span>
943-
<span class="n">module</span> <span class="o">=</span> <span class="n">torch</span><span class="o">::</span><span class="n">jit</span><span class="o">::</span><span class="n">load</span><span class="p">(</span><span class="s">"&lt;PATH TO SAVED TS MOD&gt;"</span><span class="p">);</span>
943+
<span class="k">module</span> <span class="o">=</span> <span class="n">torch</span><span class="o">::</span><span class="n">jit</span><span class="o">::</span><span class="n">load</span><span class="p">(</span><span class="s">"&lt;PATH TO SAVED TS MOD&gt;"</span><span class="p">);</span>
944944
<span class="p">}</span>
945945
<span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">c10</span><span class="o">::</span><span class="n">Error</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
946946
<span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">"error loading the model</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span>

docsrc/contributors/lowering.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ all attributes accesses are replaced with explicit inputs of the graph
8484
graph are the trainable parameters used in this method. The remaining inputs
8585
are the true inputs to the function.
8686

87+
Lower Tuples
88+
***************************************
89+
90+
`torch/csrc/jit/passes/lower_tuples.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/lower_tuples.h>`_
91+
92+
* ``LowerSimpleTuples``:
93+
94+
Removes tuples where TupleConstruct and TupleUnpack are matched but leaves tuples in place across if statements, loops, and as inputs/outputs
95+
96+
* ``LowerAllTuples``:
97+
98+
Removes _all_ tuples and raises an error if some cannot be removed, this is used by ONNX to ensure there are not tuples before conversion, but will not work on graphs whose inputs contain tuples.
99+
87100
Remove Dropout
88101
***************************************
89102

0 commit comments

Comments
 (0)