Skip to content

Commit 30d090b

Browse files
authored
Merge branch 'pytorch:main' into main
2 parents 0c9bbc1 + 4673b14 commit 30d090b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

advanced_source/neural_style_tutorial.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ def run_style_transfer(cnn, normalization_mean, normalization_std,
423423
# We want to optimize the input and not the model parameters so we
424424
# update all the requires_grad fields accordingly
425425
input_img.requires_grad_(True)
426+
# We also put the model in evaluation mode, so that specific layers
427+
# such as dropout or batch normalization layers behave correctly.
428+
model.eval()
426429
model.requires_grad_(False)
427430

428431
optimizer = get_input_optimizer(input_img)

advanced_source/super_resolution_with_onnxruntime.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
and `ONNX Runtime <https://github.com/microsoft/onnxruntime>`__.
1717
You can get binary builds of ONNX and ONNX Runtime with
1818
``pip install onnx onnxruntime``.
19-
Note that ONNX Runtime is compatible with Python versions 3.5 to 3.7.
20-
21-
``NOTE``: This tutorial needs PyTorch master branch which can be installed by following
22-
the instructions `here <https://github.com/pytorch/pytorch#from-source>`__
19+
ONNX Runtime recommends using the latest stable runtime for PyTorch.
2320
2421
"""
2522

beginner_source/nn_tutorial.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
import numpy as np
7676

7777
pyplot.imshow(x_train[0].reshape((28, 28)), cmap="gray")
78+
# ``pyplot.show()`` only if not on Colab
79+
try:
80+
import google.colab
81+
except ImportError:
82+
pyplot.show()
7883
print(x_train.shape)
7984

8085
###############################################################################

0 commit comments

Comments
 (0)