Skip to content

Commit

Permalink
Update nn_tutorial.py (#2368)
Browse files Browse the repository at this point in the history
* Update nn_tutorial.py

Fix to #1303 "add pyplot.show() in beginner tutorial."

Comments to issue suggested manually commenting out pyplot.show for users not using colab. 

---------

Co-authored-by: Svetlana Karslioglu <svekars@fb.com>
  • Loading branch information
frasertajima and Svetlana Karslioglu authored May 31, 2023
1 parent d55a262 commit 7aff96c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beginner_source/nn_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
import numpy as np

pyplot.imshow(x_train[0].reshape((28, 28)), cmap="gray")
# ``pyplot.show()`` only if not on Colab
try:
import google.colab
except ImportError:
pyplot.show()
print(x_train.shape)

###############################################################################
Expand Down

0 comments on commit 7aff96c

Please sign in to comment.