Skip to content

Commit a8121c0

Browse files
committed
[quant][pt2e][tutorials] Some fixes to pt2e quant docs
Summary: att Test Plan: . Reviewers: Subscribers: Tasks: Tags:
1 parent 1801fc3 commit a8121c0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

prototype_source/pt2e_quant_ptq_static.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ For post training quantization, we'll need to set model to the eval mode.
307307
.set_object_type(torch.nn.functional.linear, qconfig_opt) # or torch functional op
308308
.set_module_name("foo.bar", qconfig_opt)
309309
310-
We have another `tutorial <https://pytorch.org/tutorials/prototype/quantization_in_pytorch_2_0_export_tutorial.html>`_ that talks about how to write a new ``Quantizer``.
310+
We have another `tutorial <https://pytorch.org/tutorials/prototype/pt2e_quantizer.html>`_ that talks about how to write a new ``Quantizer``.
311311

312312
6. Prepare the Model for Post Training Static Quantization
313313
----------------------------------------------------------

prototype_source/pt2e_quantizer.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ Prerequisites:
1010

1111
Required:
1212
- `Torchdynamo concepts in PyTorch <https://pytorch.org/docs/stable/dynamo/index.html>`__
13+
1314
- `Quantization concepts in PyTorch <https://pytorch.org/docs/master/quantization.html#quantization-api-summary>`__
15+
1416
- `(prototype) PyTorch 2.0 Export Post Training Static Quantization <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`__
1517

1618
Optional:
1719
- `FX Graph Mode post training static quantization <https://pytorch.org/tutorials/prototype/fx_graph_mode_ptq_static.html>`__
20+
1821
- `BackendConfig in PyTorch Quantization FX Graph Mode <https://pytorch.org/tutorials/prototype/backend_config_tutorial.html?highlight=backend>`__
22+
1923
- `QConfig and QConfigMapping in PyTorch Quantization FX Graph Mode <https://pytorch.org/tutorials/prototype/backend_config_tutorial.html#set-up-qconfigmapping-that-satisfies-the-backend-constraints>`__
2024

2125
Introduction
@@ -25,12 +29,12 @@ Introduction
2529
(1). What is supported quantized operator or patterns in the backend
2630
(2). How can users express the way they want their floating point model to be quantized, for example, quantized the whole model to be int8 symmetric quantization, or quantize only linear layers etc.
2731

28-
Please see `here <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`__ For motivations for ``Quantizer``.
32+
Please see `here <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html#motivation-of-pytorch-2-0-export-quantization>`__ For motivations for the new API and ``Quantizer``.
2933

3034
An existing quantizer object defined for ``XNNPACK`` is in
3135
`QNNPackQuantizer <https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/pt2e/quantizer/xnnpack_quantizer.py>`__
3236

33-
Annotation API:
37+
Annotation API
3438
^^^^^^^^^^^^^^^^^^^
3539

3640
``Quantizer`` uses annotation API to convey quantization intent for different operators/patterns.
@@ -269,4 +273,4 @@ Conclusion
269273
With this tutorial, we introduce the new quantization path in PyTorch 2.0. Users can learn about
270274
how to define a ``BackendQuantizer`` with the ``QuantizationAnnotation API`` and integrate it into the quantization 2.0 flow.
271275
Examples of ``QuantizationSpec``, ``SharedQuantizationSpec``, ``FixedQParamsQuantizationSpec``, and ``DerivedQuantizationSpec``
272-
are given for specific annotation use case. This is a prerequisite to be able to quantize a model in PyTorch 2.0 Export Quantization flow. Please follow `this tutorial <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`_ to actually quantize a model.
276+
are given for specific annotation use case. This is a prerequisite to be able to quantize a model in PyTorch 2.0 Export Quantization flow. You can use `XNNPACKQuantizer <https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/quantizer/xnnpack_quantizer.py>`_ as an example to start implementing your own ``Quantizer``. After that please follow `this tutorial <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`_ to actually quantize your model.

0 commit comments

Comments
 (0)