Skip to content

Commit 137c71c

Browse files
authored
Merge branch 'master' into tensorboard_profiler
2 parents 4868a5e + 8261008 commit 137c71c

File tree

7 files changed

+187
-28
lines changed

7 files changed

+187
-28
lines changed
Loading
Loading

beginner_source/fgsm_tutorial.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@
9999
import numpy as np
100100
import matplotlib.pyplot as plt
101101

102+
# NOTE: This is a hack to get around "User-agent" limitations when downloading MNIST datasets
103+
# see, https://github.com/pytorch/vision/issues/3497 for more information
104+
from six.moves import urllib
105+
opener = urllib.request.build_opener()
106+
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
107+
urllib.request.install_opener(opener)
108+
102109

103110
######################################################################
104111
# Implementation
@@ -413,4 +420,3 @@ def test( model, device, test_loader, epsilon ):
413420
# it differs from FGSM. Then, try to defend the model from your own
414421
# attacks.
415422
#
416-

index.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,6 @@ Welcome to PyTorch Tutorials
217217

218218
.. Frontend APIs
219219
220-
.. customcarditem::
221-
:header: (prototype) Introduction to Named Tensors in PyTorch
222-
:card_description: Learn how to use PyTorch to train a Deep Q Learning (DQN) agent on the CartPole-v0 task from the OpenAI Gym.
223-
:image: _static/img/thumbnails/cropped/experimental-Introduction-to-Named-Tensors-in-PyTorch.png
224-
:link: intermediate/named_tensor_tutorial.html
225-
:tags: Frontend-APIs,Named-Tensor,Best-Practice
226-
227220
.. customcarditem::
228221
:header: (beta) Channels Last Memory Format in PyTorch
229222
:card_description: Get an overview of Channels Last memory format and understand how it is used to order NCHW tensors in memory preserving dimensions.
@@ -243,21 +236,21 @@ Welcome to PyTorch Tutorials
243236
:card_description: Create a neural network layer with no parameters using numpy. Then use scipy to create a neural network layer that has learnable weights.
244237
:image: _static/img/thumbnails/cropped/Custom-Cpp-and-CUDA-Extensions.png
245238
:link: advanced/cpp_extension.html
246-
:tags: Frontend-APIs,C++,CUDA
239+
:tags: Extending-PyTorch,Frontend-APIs,C++,CUDA
247240

248241
.. customcarditem::
249242
:header: Extending TorchScript with Custom C++ Operators
250243
:card_description: Implement a custom TorchScript operator in C++, how to build it into a shared library, how to use it in Python to define TorchScript models and lastly how to load it into a C++ application for inference workloads.
251244
:image: _static/img/thumbnails/cropped/Extending-TorchScript-with-Custom-Cpp-Operators.png
252245
:link: advanced/torch_script_custom_ops.html
253-
:tags: Frontend-APIs,TorchScript,C++
246+
:tags: Extending-PyTorch,Frontend-APIs,TorchScript,C++
254247

255248
.. customcarditem::
256249
:header: Extending TorchScript with Custom C++ Classes
257250
:card_description: This is a continuation of the custom operator tutorial, and introduces the API we’ve built for binding C++ classes into TorchScript and Python simultaneously.
258251
:image: _static/img/thumbnails/cropped/Extending-TorchScript-with-Custom-Cpp-Classes.png
259252
:link: advanced/torch_script_custom_classes.html
260-
:tags: Frontend-APIs,TorchScript,C++
253+
:tags: Extending-PyTorch,Frontend-APIs,TorchScript,C++
261254

262255
.. customcarditem::
263256
:header: Dynamic Parallelism in TorchScript
@@ -461,6 +454,7 @@ Additional Resources
461454
:caption: PyTorch Recipes
462455

463456
See All Recipes <recipes/recipes_index>
457+
See All Prototype Recipes <prototype/prototype_index>
464458

465459
.. toctree::
466460
:maxdepth: 2
@@ -534,14 +528,20 @@ Additional Resources
534528
:hidden:
535529
:caption: Frontend APIs
536530

537-
intermediate/named_tensor_tutorial
538531
intermediate/memory_format_tutorial
539532
advanced/cpp_frontend
533+
advanced/torch-script-parallelism
534+
advanced/cpp_autograd
535+
536+
.. toctree::
537+
:maxdepth: 2
538+
:includehidden:
539+
:hidden:
540+
:caption: Extending PyTorch
541+
540542
advanced/cpp_extension
541543
advanced/torch_script_custom_ops
542544
advanced/torch_script_custom_classes
543-
advanced/torch-script-parallelism
544-
advanced/cpp_autograd
545545
advanced/dispatcher
546546
advanced/extend_dispatcher
547547

@@ -581,6 +581,6 @@ Additional Resources
581581
:hidden:
582582
:caption: Mobile
583583

584-
beginner/deeplabv3_on_ios.html
585-
beginner/deeplabv3_on_android.html
584+
beginner/deeplabv3_on_ios
585+
beginner/deeplabv3_on_android
586586

intermediate_source/quantized_transfer_learning_tutorial.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -450,19 +450,20 @@ the feature extractor is quantized).
450450
.. note:: Because of the random initialization your results might differ from
451451
the results shown in this tutorial.
452452

453+
.. code:: python
453454
454-
# notice `quantize=False`
455-
model = models.resnet18(pretrained=True, progress=True, quantize=False)
456-
num_ftrs = model.fc.in_features
457-
458-
# Step 1
459-
model.train()
460-
model.fuse_model()
461-
# Step 2
462-
model_ft = create_combined_model(model)
463-
model_ft[0].qconfig = torch.quantization.default_qat_qconfig # Use default QAT configuration
464-
# Step 3
465-
model_ft = torch.quantization.prepare_qat(model_ft, inplace=True)
455+
# notice `quantize=False`
456+
model = models.resnet18(pretrained=True, progress=True, quantize=False)
457+
num_ftrs = model.fc.in_features
458+
459+
# Step 1
460+
model.train()
461+
model.fuse_model()
462+
# Step 2
463+
model_ft = create_combined_model(model)
464+
model_ft[0].qconfig = torch.quantization.default_qat_qconfig # Use default QAT configuration
465+
# Step 3
466+
model_ft = torch.quantization.prepare_qat(model_ft, inplace=True)
466467
467468
468469
Finetuning the model

intermediate_source/spatial_transformer_tutorial.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
# standard convolutional network augmented with a spatial transformer
4848
# network.
4949

50+
from six.moves import urllib
51+
opener = urllib.request.build_opener()
52+
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
53+
urllib.request.install_opener(opener)
54+
5055
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5156

5257
# Training dataset

prototype_source/prototype_index.rst

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
PyTorch Prototype Recipes
2+
---------------------------------------------
3+
Prototype features are not available as part of binary distributions like PyPI or Conda (except maybe behind run-time flags). To test these features we would, depending on the feature, recommend building from master or using the nightly wheels that are made available on `pytorch.org <https://pytorch.org>`_.
4+
5+
*Level of commitment*: We are committing to gathering high bandwidth feedback only on these features. Based on this feedback and potential further engagement between community members, we as a community will decide if we want to upgrade the level of commitment or to fail fast.
6+
7+
8+
.. raw:: html
9+
10+
</div>
11+
</div>
12+
13+
<div id="tutorial-cards-container">
14+
15+
<nav class="navbar navbar-expand-lg navbar-light tutorials-nav col-12">
16+
<div class="tutorial-tags-container">
17+
<div id="dropdown-filter-tags">
18+
<div class="tutorial-filter-menu">
19+
<div class="tutorial-filter filter-btn all-tag-selected" data-tag="all">All</div>
20+
</div>
21+
</div>
22+
</div>
23+
</nav>
24+
25+
<hr class="tutorials-hr">
26+
27+
<div class="row">
28+
29+
<div id="tutorial-cards">
30+
<div class="list">
31+
32+
.. Add prototype tutorial cards below this line
33+
34+
.. Quantization
35+
36+
.. customcarditem::
37+
:header: FX Graph Mode Quantization User Guide
38+
:card_description: Learn about FX Graph Mode Quantization.
39+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
40+
:link: ../prototype/fx_graph_mode_quant_guide.html
41+
:tags: FX,Quantization
42+
43+
.. customcarditem::
44+
:header: FX Graph Mode Post Training Dynamic Quantization
45+
:card_description: Learn how to do post training dynamic quantization in graph mode based on torch.fx.
46+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
47+
:link: ../prototype/fx_graph_mode_ptq_dynamic.html
48+
:tags: FX,Quantization
49+
50+
.. customcarditem::
51+
:header: FX Graph Mode Post Training Static Quantization
52+
:card_description: Learn how to do post training static quantization in graph mode based on torch.fx.
53+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
54+
:link: ../prototype/fx_graph_mode_ptq_static.html
55+
:tags: FX,Quantization
56+
57+
.. customcarditem::
58+
:header: Graph Mode Dynamic Quantization on BERT
59+
:card_description: Learn how to do post training dynamic quantization with graph mode quantization on BERT models.
60+
:image: ../_static/img/thumbnails/cropped/graph-mode-dynamic-bert.PNG
61+
:link: ../prototype/graph_mode_dynamic_bert_tutorial.html
62+
:tags: Text,Quantization
63+
64+
.. customcarditem::
65+
:header: PyTorch Numeric Suite Tutorial
66+
:card_description: Learn how to use the PyTorch Numeric Suite to support quantization debugging efforts.
67+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
68+
:link: ../prototype/numeric_suite_tutorial.html
69+
:tags: Debugging,Quantization
70+
71+
.. Mobile
72+
73+
.. customcarditem::
74+
:header: Use iOS GPU in PyTorch
75+
:card_description: Learn how to run your models on iOS GPU.
76+
:image: ../_static/img/thumbnails/cropped/ios.PNG
77+
:link: ../prototype/ios_gpu_workflow.html
78+
:tags: Mobile
79+
80+
.. customcarditem::
81+
:header: Convert MobileNetV2 to NNAPI
82+
:card_description: Learn how to prepare a computer vision model to use Android’s Neural Networks API (NNAPI).
83+
:image: ../_static/img/thumbnails/cropped/android.PNG
84+
:link: ../prototype/nnapi_mobilenetv2.html
85+
:tags: Mobile
86+
87+
.. customcarditem::
88+
:header: PyTorch Vulkan Backend User Workflow
89+
:card_description: Learn how to use the Vulkan backend on mobile GPUs.
90+
:image: ../_static/img/thumbnails/cropped/android.PNG
91+
:link: ../prototype/vulkan_workflow.html
92+
:tags: Mobile
93+
94+
.. customcarditem::
95+
:header: Lite Interpreter Workflow in Android and iOS
96+
:card_description: Learn how to use the lite interpreter on iOS and Andriod devices.
97+
:image: ../_static/img/thumbnails/cropped/mobile.PNG
98+
:link: ../prototype/lite_interpreter.html
99+
:tags: Mobile
100+
101+
.. TorchScript
102+
103+
.. customcarditem::
104+
:header: Model Freezing in TorchScript
105+
:card_description: Freezing is the process of inlining Pytorch module parameters and attributes values into the TorchScript internal representation.
106+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
107+
:link: ../prototype/torchscript_freezing.html
108+
:tags: TorchScript
109+
110+
.. vmap
111+
112+
.. customcarditem::
113+
:header: Using torch.vmap
114+
:card_description: Learn about torch.vmap, an autovectorizer for PyTorch operations.
115+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.PNG
116+
:link: ../prototype/vmap_recipe.html
117+
:tags: vmap
118+
119+
.. End of tutorial card section
120+
121+
.. raw:: html
122+
123+
</div>
124+
125+
<div class="pagination d-flex justify-content-center"></div>
126+
127+
</div>
128+
129+
</div>
130+
131+
.. -----------------------------------------
132+
.. Page TOC
133+
.. -----------------------------------------
134+
.. toctree::
135+
:hidden:
136+
137+
prototype/fx_graph_mode_quant_guide.html
138+
prototype/fx_graph_mode_ptq_dynamic.html
139+
prototype/fx_graph_mode_ptq_static.html
140+
prototype/graph_mode_dynamic_bert_tutorial.html
141+
prototype/ios_gpu_workflow.html
142+
prototype/nnapi_mobilenetv2.html
143+
prototype/numeric_suite_tutorial.html
144+
prototype/torchscript_freezing.html
145+
prototype/vmap_recipe.html
146+
prototype/vulkan_workflow.html
147+
prototype/lite_interpreter.html

0 commit comments

Comments
 (0)