Skip to content
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

docs: fix wrong name for example neural net #2959

Merged
merged 3 commits into from Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/source/frameworks/pytorch.rst
Expand Up @@ -21,7 +21,8 @@ For common PyTorch models with single input:

.. code-block:: python
:caption: `train.py`


import bentoml
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down Expand Up @@ -74,7 +75,7 @@ For common PyTorch models with single input:
import torch.optim as optim

criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9)
optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)

for epoch in range(2): # a small epoch just for demostration purpose
for i, data in enumerate(trainloader, 0):
Expand All @@ -85,7 +86,7 @@ For common PyTorch models with single input:
optimizer.zero_grad()

# forward + backward + optimize
outputs = net(inputs)
outputs = model(inputs)
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
Expand Down