CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
pytorch

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: pytorch/tutorials
Path: blob/main/beginner_source/template_tutorial.py
Views: 712
1
# -*- coding: utf-8 -*-
2
3
"""
4
Template Tutorial
5
=================
6
7
**Author:** `FirstName LastName <https://github.com/username>`_
8
9
.. grid:: 2
10
11
.. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn
12
:class-card: card-prerequisites
13
14
* Item 1
15
* Item 2
16
* Item 3
17
18
.. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites
19
:class-card: card-prerequisites
20
21
* PyTorch v2.0.0
22
* GPU ???
23
* Other items 3
24
25
If you have a video, add it here like this:
26
27
.. raw:: html
28
29
<div style="margin-top:10px; margin-bottom:10px;">
30
<iframe width="560" height="315" src="https://www.youtube.com/embed/IC0_FRiX-sw" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
31
</div>
32
33
To test your tutorial locally, you can do one of the following:
34
35
* You can control specific files that generate the results by using
36
``GALLERY_PATTERN`` environment variable. The GALLERY_PATTERN variable
37
respects regular expressions.
38
For example to run only ``neural_style_transfer_tutorial.py``,
39
use the following command:
40
41
.. code-block:: sh
42
43
GALLERY_PATTERN="neural_style_transfer_tutorial.py" make html
44
45
or
46
47
.. code-block:: sh
48
49
GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build
50
51
* Make a copy of this repository and add only your
52
tutorial to the `beginner_source` directory removing all other tutorials.
53
Then run ``make html``.
54
55
Verify that all outputs were generated correctly in the created HTML.
56
"""
57
58
#########################################################################
59
# Overview
60
# --------
61
#
62
# Describe Why is this topic important? Add Links to relevant research papers.
63
#
64
# This tutorial walks you through the process of....
65
#
66
# Steps
67
# -----
68
#
69
# Example code (the output below is generated automatically):
70
#
71
import torch
72
x = torch.rand(5, 3)
73
print(x)
74
75
######################################################################
76
# (Optional) Additional Exercises
77
# -------------------------------
78
#
79
# Add additional practice exercises for users to test their knowledge.
80
# Example: `NLP from Scratch <https://pytorch.org/tutorials/intermediate/char_rnn_generation_tutorial.html#exercises>`__.
81
#
82
83
######################################################################
84
# Conclusion
85
# ----------
86
#
87
# Summarize the steps and concepts covered. Highlight key takeaways.
88
#
89
# Further Reading
90
# ---------------
91
#
92
# * Link1
93
# * Link2
94
95
96