Skip to content

Fix formatting to follow template for Profiler Recipe #3437

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

Merged
merged 5 commits into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions recipes_source/recipes/profiler_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,29 @@
"""

######################################################################
"""
This recipe explains how to use PyTorch profiler and measure the time and
memory consumption of the model's operators.

Introduction
------------
PyTorch includes a simple profiler API that is useful when user needs
to determine the most expensive operators in the model.

In this recipe, we will use a simple Resnet model to demonstrate how to
use profiler to analyze model performance.

Prerequisites
---------------
- ``torch >= 1.9``

Setup
-----
To install ``torch`` and ``torchvision`` use the following command:

.. code-block:: sh

pip install torch torchvision

"""
# This recipe explains how to use PyTorch profiler and measure the time and
# memory consumption of the model's operators.
#
# Introduction
# ------------
# PyTorch includes a simple profiler API that is useful when the user needs
# to determine the most expensive operators in the model.
#
# In this recipe, we will use a simple Resnet model to demonstrate how to
# use the profiler to analyze model performance.
#
# Prerequisites
# ---------------
# - ``torch >= 2.3.0``
#
# Setup
# -----
# To install ``torch`` and ``torchvision`` use the following command:
#
# .. code-block:: sh
#
# pip install torch torchvision
#

######################################################################
# Steps
Expand Down