Skip to content

Commit 024097e

Browse files
authored
small formatting fix on build model page (#32)
* fix formating on build model page
1 parent 3ca1702 commit 024097e

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

beginner_source/quickstart/build_model_tutorial.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
"""
22
Build Model Tutorial
3-
=======================================
4-
5-
The data has been loaded and transformed we can now build the model.
6-
We will leverage `torch.nn <https://pytorch.org/docs/stable/nn.html>`_ predefined layers that PyTorch has that can simplify our code.
7-
8-
In the below example, for our FashionMNIT image dataset, we are using a `Sequential`
9-
container from class `torch.nn. Sequential <https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html>`_
10-
that allows us to define the model layers inline. In the "Sequential" in-line model building format the ``forward()``
11-
method is created for you and the modules you add are passed in as a list or dictionary in the order that are they are defined.
12-
13-
Another way to bulid this model is with a class
14-
using `nn.Module <https://pytorch.org/docs/stable/generated/torch.nn.Module.html)>`_
15-
A big plus with using a class that inherits ``nn.Module`` is better parameter management across all nested submodules.
16-
This gives us more flexibility, because we can construct layers of any complexity, including the ones with shared weights.
17-
18-
Lets break down the steps to build this model below
3+
============================
194
"""
205

6+
##########################################
7+
# The data has been loaded and transformed we can now build the model.
8+
# We will leverage `torch.nn <https://pytorch.org/docs/stable/nn.html>`_ predefined layers that PyTorch has that can simplify our code.
9+
#
10+
# In the below example, for our FashionMNIT image dataset, we are using a `Sequential`
11+
# container from class `torch.nn. Sequential <https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html>`_
12+
# that allows us to define the model layers inline. In the "Sequential" in-line model building format the ``forward()``
13+
# method is created for you and the modules you add are passed in as a list or dictionary in the order that are they are defined.
14+
#
15+
# Another way to bulid this model is with a class
16+
# using `nn.Module <https://pytorch.org/docs/stable/generated/torch.nn.Module.html)>`_
17+
# A big plus with using a class that inherits ``nn.Module`` is better parameter management across all nested submodules.
18+
# This gives us more flexibility, because we can construct layers of any complexity, including the ones with shared weights.
19+
#
20+
# Lets break down the steps to build this model below
21+
#
22+
2123
##########################################
2224
# Inline nn.Sequential Example:
2325
# ----------------------------

0 commit comments

Comments
 (0)