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

Update nn_tutorial.py #2368

Merged
merged 3 commits into from
May 31, 2023
Merged

Update nn_tutorial.py #2368

merged 3 commits into from
May 31, 2023

Conversation

frasertajima
Copy link
Contributor

@frasertajima frasertajima commented May 31, 2023

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

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

Instead, suggest change that imports colab and does nothing if user is running notebook on colab, otherwise it runs pyplot.show() (such as when running on a local machine).

This way, manual editing of notebook is not required, colab users are undisturbed and local users get pyplot.show.

Fixes #1303

Description

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnessessary issues are included into this pull request.

cc @suraj813

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

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

Instead, suggest change that imports colab and does nothing if user is running notebook on colab, otherwise it runs pyplot.show() (such as when running on a local machine). 

This way, manual editing of notebook is not required, colab users are undisturbed and local users get pyplot.show.
import google.colab
except ImportError:
pyplot.show()
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is pass needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass is not needed given pyplot.show(). Sorry!

@netlify
Copy link

netlify bot commented May 31, 2023

Deploy Preview for pytorch-tutorials-preview ready!

Name Link
🔨 Latest commit ee73af6
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-tutorials-preview/deploys/6477cd854565d7000869dc28
😎 Deploy Preview https://deploy-preview-2368--pytorch-tutorials-preview.netlify.app/beginner/nn_tutorial
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added intro docathon-h1-2023 A label for the docathon in H1 2023 easy and removed cla signed labels May 31, 2023
removed unnecessary "pass" (because pyplot.show() is present).
@svekars svekars merged commit 7aff96c into pytorch:main May 31, 2023
7 checks passed
@frasertajima frasertajima deleted the patch-2 branch June 1, 2023 00:00
@kit1980
Copy link
Member

kit1980 commented Jun 1, 2023

@frasertajima next time please use Fixes # from the template instead of Fix to#, so GitHub will automatically close the linked issue after the PR is merged.

@frasertajima
Copy link
Contributor Author

Thanks. I amended #2111 and #1781 accordingly but they still linger.

@kit1980
Copy link
Member

kit1980 commented Jun 2, 2023

Thanks. I amended #2111 and #1781 accordingly but they still linger.

I've closed those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docathon-h1-2023 A label for the docathon in H1 2023 easy intro
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add pyplot.show() in beginner tutorial.
4 participants