From 8b2c99dbc2223739ffdab8991cc748a8b9dbf255 Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Thu, 12 May 2022 17:35:26 +0200 Subject: [PATCH 1/3] [DOC] Add quantized inception updated documentation. --- docs/source/models/inception_quant.rst | 24 ++++++++++++++++++++++++ docs/source/models_new.rst | 1 + 2 files changed, 25 insertions(+) create mode 100644 docs/source/models/inception_quant.rst diff --git a/docs/source/models/inception_quant.rst b/docs/source/models/inception_quant.rst new file mode 100644 index 00000000000..dc3789766d7 --- /dev/null +++ b/docs/source/models/inception_quant.rst @@ -0,0 +1,24 @@ +Quantized Inception +=================== + +.. currentmodule:: torchvision.models.quantization + +The Quantized Inception model is based on the `Rethinking the Inception Architecture for +Computer Vision `__ paper. + + +Model builders +-------------- + +The following model builders can be used to instanciate a quantized Inception +model, with or without pre-trained weights. All the model builders internally +rely on the ``torchvision.models.quantization.inception.QuantizableInception3`` +base class. Please refer to the `source code +`_ +for more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + inception_v3 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 31b349ac37b..ee5d6203ebd 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -77,6 +77,7 @@ pre-trained weights: :maxdepth: 1 models/googlenet_quant + models/inception_quant Table of all available quantized classification weights From 19ef6af8705bda0393975c8d1d84f5ef033f2dcc Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Thu, 12 May 2022 17:36:37 +0200 Subject: [PATCH 2/3] Add missing file. --- torchvision/models/quantization/inception.py | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/torchvision/models/quantization/inception.py b/torchvision/models/quantization/inception.py index e774f4ce155..74083262c1e 100644 --- a/torchvision/models/quantization/inception.py +++ b/torchvision/models/quantization/inception.py @@ -208,7 +208,7 @@ def inception_v3( **kwargs: Any, ) -> QuantizableInception3: r"""Inception v3 model architecture from - `"Rethinking the Inception Architecture for Computer Vision" `_. + `Rethinking the Inception Architecture for Computer Vision `__. .. note:: **Important**: In contrast to the other models the inception_v3 expects tensors with a size of @@ -219,10 +219,26 @@ def inception_v3( GPU inference is not yet supported Args: - weights (Inception_V3_QuantizedWeights or Inception_V3_Weights, optional): The pretrained - weights for the model - progress (bool): If True, displays a progress bar of the download to stderr - quantize (bool): If True, return a quantized version of the model + weights (:class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` or :class:`~torchvision.models.quantization.Inception_V3_Weights`, optional): The pretrained + weights for the model. See + :class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` below for + more details, and possible values. By default, no pre-trained + weights are used. + progress (bool, optional): If True, displays a progress bar of the download to stderr. + Default is True. + quantize (bool, optional): If True, return a quantized version of the model. + Default is False. + **kwargs: parameters passed to the ``torchvision.models.quantization.QuantizableInception3`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.quantization.Inception_V3_QuantizedWeights + :members: + + .. autoclass:: torchvision.models.Inception_V3_Weights + :members: + :noindex: """ weights = (Inception_V3_QuantizedWeights if quantize else Inception_V3_Weights).verify(weights) From 8d83d855b1502edc454c06c1d4f362ce47fd6423 Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Fri, 13 May 2022 15:14:45 +0200 Subject: [PATCH 3/3] Apply suggestions from code review [ENH] Improve doc thanks to various code review comments. Co-authored-by: Aditya Oke <47158509+oke-aditya@users.noreply.github.com> Co-authored-by: Nicolas Hug --- docs/source/models/inception_quant.rst | 4 ++-- torchvision/models/quantization/inception.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/models/inception_quant.rst b/docs/source/models/inception_quant.rst index dc3789766d7..397fd10df3c 100644 --- a/docs/source/models/inception_quant.rst +++ b/docs/source/models/inception_quant.rst @@ -1,5 +1,5 @@ -Quantized Inception -=================== +Quantized InceptionV3 +===================== .. currentmodule:: torchvision.models.quantization diff --git a/torchvision/models/quantization/inception.py b/torchvision/models/quantization/inception.py index 74083262c1e..54a993200a6 100644 --- a/torchvision/models/quantization/inception.py +++ b/torchvision/models/quantization/inception.py @@ -219,7 +219,7 @@ def inception_v3( GPU inference is not yet supported Args: - weights (:class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` or :class:`~torchvision.models.quantization.Inception_V3_Weights`, optional): The pretrained + weights (:class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` or :class:`~torchvision.models.Inception_V3_Weights`, optional): The pretrained weights for the model. See :class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` below for more details, and possible values. By default, no pre-trained @@ -230,7 +230,7 @@ def inception_v3( Default is False. **kwargs: parameters passed to the ``torchvision.models.quantization.QuantizableInception3`` base class. Please refer to the `source code - `_ + `_ for more details about this class. .. autoclass:: torchvision.models.quantization.Inception_V3_QuantizedWeights