From aca4efd62b7d5a922609bc1d553e4f328c97f757 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Mon, 10 Oct 2022 15:30:32 -0700 Subject: [PATCH 1/5] Add a Python tutorial template --- beginner_source/template_tutorial.py | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 beginner_source/template_tutorial.py diff --git a/beginner_source/template_tutorial.py b/beginner_source/template_tutorial.py new file mode 100644 index 00000000000..0f2041aea73 --- /dev/null +++ b/beginner_source/template_tutorial.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +""" +Template Tutorial +================ + +**Author:** `FirstName LastName `_ + +.. grid:: 2 + + .. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn + + * Item 1 + * Item 2 + * Item 3 + + .. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites + + * PyTorch v2.0.0 + * GPU ??? + * Other items 3 + +If you have a video, add it here like this: + +.. raw:: html + +
+ +
+ +To test your tutorial locally, make a copy of the repo and add only your +tutorial. Then run make html. Verify that all outputs were generated correctly +in the created HTML. + +""" + +######################################################################### +# Overview +# -------- +# +# Describe Why is this topic important? Add Links to relevant research papers. +# +# This tutorial walks you through the process of.... +# +# Steps +# ----- +# +# Example code (the output below is generated automatically): +# +import torch +x = torch.rand(5, 3) +print(x) + +###################################################################### +# (Optional) Additional Exercises +# ------------------------------- +# +# Add additional practice exercises for users to test their knowledge. +# Example: `NLP from Scratch `__. +# + +###################################################################### +# Conclusion +# ---------- +# +# Summarize the steps and concepts covered. Highlight key takeaways. +# +# Further Reading +# --------------- +# +# * Link1 +# * Link2 + From 9b930cce7a5e00dca08ee62e6cfcff1168d93462 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Fri, 24 Mar 2023 09:50:33 -0700 Subject: [PATCH 2/5] Update template_tutorial.py --- beginner_source/template_tutorial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beginner_source/template_tutorial.py b/beginner_source/template_tutorial.py index 0f2041aea73..1e49fc6dadf 100644 --- a/beginner_source/template_tutorial.py +++ b/beginner_source/template_tutorial.py @@ -2,7 +2,7 @@ """ Template Tutorial -================ +================= **Author:** `FirstName LastName `_ @@ -28,8 +28,8 @@ -To test your tutorial locally, make a copy of the repo and add only your -tutorial. Then run make html. Verify that all outputs were generated correctly +To test your tutorial locally, make a copy of this repo and add only your +tutorial removing everything. Then run ``make html``. Verify that all outputs were generated correctly in the created HTML. """ From 2f440ae6c8fe93df45206c953c6b911a74a4baaa Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Fri, 24 Mar 2023 14:30:04 -0700 Subject: [PATCH 3/5] Update template_tutorial.py Address feedback and add another option to build locally --- beginner_source/template_tutorial.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/beginner_source/template_tutorial.py b/beginner_source/template_tutorial.py index 1e49fc6dadf..e76d417c65a 100644 --- a/beginner_source/template_tutorial.py +++ b/beginner_source/template_tutorial.py @@ -28,10 +28,28 @@ -To test your tutorial locally, make a copy of this repo and add only your -tutorial removing everything. Then run ``make html``. Verify that all outputs were generated correctly -in the created HTML. - +To test your tutorial locally, you can do one of the following: + +* You can control specific files that generate the results by using + ``GALLERY_PATTERN`` environment variable, For example to run only ``neural_style_transfer_tutorial.py``, + run the following command: + + .. code-block:: + + GALLERY_PATTERN="neural_style_transfer_tutorial.py" make html + + or + + .. code-block:: + + GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build + + The GALLERY_PATTERN variable respects regular expressions. + +* Make a copy of this repo and add only your + tutorial removing everything. Then run ``make html``. + +Verify that all outputs were generated correctly in the created HTML. """ ######################################################################### From 1ca1a6a6a72936acefb668ea8149d0bbc02ed142 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Fri, 24 Mar 2023 14:40:19 -0700 Subject: [PATCH 4/5] Update template_tutorial.py Minor fixes. --- beginner_source/template_tutorial.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/beginner_source/template_tutorial.py b/beginner_source/template_tutorial.py index e76d417c65a..54111ad1f02 100644 --- a/beginner_source/template_tutorial.py +++ b/beginner_source/template_tutorial.py @@ -31,20 +31,20 @@ To test your tutorial locally, you can do one of the following: * You can control specific files that generate the results by using - ``GALLERY_PATTERN`` environment variable, For example to run only ``neural_style_transfer_tutorial.py``, - run the following command: + ``GALLERY_PATTERN`` environment variable. The GALLERY_PATTERN variable + respects regular expressions. + For example to run only ``neural_style_transfer_tutorial.py``, + use the following command: - .. code-block:: + .. code-block:: sh GALLERY_PATTERN="neural_style_transfer_tutorial.py" make html or - .. code-block:: + .. code-block:: sh GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build - - The GALLERY_PATTERN variable respects regular expressions. * Make a copy of this repo and add only your tutorial removing everything. Then run ``make html``. From e08196b88de3a52dc06d8b0558b9b5b3416191e8 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 28 Mar 2023 10:50:19 -0700 Subject: [PATCH 5/5] Update template_tutorial.py --- beginner_source/template_tutorial.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beginner_source/template_tutorial.py b/beginner_source/template_tutorial.py index 54111ad1f02..7e3e0220f0e 100644 --- a/beginner_source/template_tutorial.py +++ b/beginner_source/template_tutorial.py @@ -47,7 +47,8 @@ GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build * Make a copy of this repo and add only your - tutorial removing everything. Then run ``make html``. + tutorial to the `beginner_source` directory removing all other tutorials. + Then run ``make html``. Verify that all outputs were generated correctly in the created HTML. """