Skip to content

Commit 54c6b43

Browse files
authored
Add comment on using torch.utils.benchmark (#2147)
* add comment on using torch.utils.benchmark * change from recommendation to try
1 parent a46de9b commit 54c6b43

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

intermediate_source/torch_compile_tutorial.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ much as possible, and so we chose ``"reduce-overhead"``. For your own models,
184184
you may need to experiment with different modes to maximize speedup. You can
185185
read more about modes `here <https://pytorch.org/get-started/pytorch-2.0/#user-experience>`__.
186186

187+
For general PyTorch benchmarking, you can try using ``torch.utils.benchmark`` instead of the ``timed``
188+
function we defined above. We wrote our own timing function in this tutorial to show
189+
``torch.compile``'s compilation latency.
190+
187191
Now, let's consider comparing training.
188192

189193
.. code-block:: python

intermediate_source/torch_compile_tutorial_.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ def evaluate(mod, inp):
187187
# you may need to experiment with different modes to maximize speedup. You can
188188
# read more about modes `here <https://pytorch.org/get-started/pytorch-2.0/#user-experience>`__.
189189
#
190+
# For general PyTorch benchmarking, you can try using ``torch.utils.benchmark`` instead of the ``timed``
191+
# function we defined above. We wrote our own timing function in this tutorial to show
192+
# ``torch.compile``'s compilation latency.
193+
#
190194
# Now, let's consider comparing training.
191195

192196
model = init_model()

0 commit comments

Comments
 (0)