@@ -66,8 +66,11 @@ class QuantizableShuffleNetV2(shufflenetv2.ShuffleNetV2):
...
@@ -66,8 +66,11 @@ class QuantizableShuffleNetV2(shufflenetv2.ShuffleNetV2):
r"""Fuse conv/bn/relu modules in shufflenetv2 model
r"""Fuse conv/bn/relu modules in shufflenetv2 model
Fuse conv+bn+relu/ conv+relu/conv+bn modules to prepare for quantization.
Fuse conv+bn+relu/ conv+relu/conv+bn modules to prepare for quantization.
Model is modified in place. Note that this operation does not change numerics
Model is modified in place.
and the model after modification is in floating point
.. note::
Note that this operation does not change numerics
and the model after modification is in floating point
"""
"""
forname,minself._modules.items():
forname,minself._modules.items():
ifnamein["conv1","conv5"]andmisnotNone:
ifnamein["conv1","conv5"]andmisnotNone:
...
@@ -205,8 +208,8 @@ def shufflenet_v2_x0_5(
...
@@ -205,8 +208,8 @@ def shufflenet_v2_x0_5(
)->QuantizableShuffleNetV2:
)->QuantizableShuffleNetV2:
"""
"""
Constructs a ShuffleNetV2 with 0.5x output channels, as described in
Constructs a ShuffleNetV2 with 0.5x output channels, as described in
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
<https://arxiv.org/abs/1807.11164>`_.
<https://arxiv.org/abs/1807.11164>`__.
.. note::
.. note::
Note that ``quantize = True`` returns a quantized model with 8 bit
Note that ``quantize = True`` returns a quantized model with 8 bit
...
@@ -214,10 +217,26 @@ def shufflenet_v2_x0_5(
...
@@ -214,10 +217,26 @@ def shufflenet_v2_x0_5(
GPU inference is not yet supported.
GPU inference is not yet supported.
Args:
Args:
weights (ShuffleNet_V2_X0_5_QuantizedWeights or ShuffleNet_V2_X0_5_Weights, optional): The pretrained
weights (:class:`~torchvision.models.quantization.ShuffleNet_V2_X0_5_QuantizedWeights` or :class:`~torchvision.models.ShuffleNet_V2_X0_5_Weights`, optional): The
weights for the model
pretrained weights for the model. See
progress (bool): If True, displays a progress bar of the download to stderr
:class:`~torchvision.models.quantization.ShuffleNet_V2_X0_5_QuantizedWeights` below for
quantize (bool): If True, return a quantized version of the model
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.ShuffleNet_V2_X0_5_QuantizedWeights``
Constructs a ShuffleNetV2 with 1.0x output channels, as described in
Constructs a ShuffleNetV2 with 1.0x output channels, as described in
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
<https://arxiv.org/abs/1807.11164>`_.
<https://arxiv.org/abs/1807.11164>`__.
.. note::
.. note::
Note that ``quantize = True`` returns a quantized model with 8 bit
Note that ``quantize = True`` returns a quantized model with 8 bit
...
@@ -251,10 +270,26 @@ def shufflenet_v2_x1_0(
...
@@ -251,10 +270,26 @@ def shufflenet_v2_x1_0(
GPU inference is not yet supported.
GPU inference is not yet supported.
Args:
Args:
weights (ShuffleNet_V2_X1_0_QuantizedWeights or ShuffleNet_V2_X1_0_Weights, optional): The pretrained
weights (:class:`~torchvision.models.quantization.ShuffleNet_V2_X1_0_QuantizedWeights` or :class:`~torchvision.models.ShuffleNet_V2_X1_0_Weights`, optional): The
weights for the model
pretrained weights for the model. See
progress (bool): If True, displays a progress bar of the download to stderr
:class:`~torchvision.models.quantization.ShuffleNet_V2_X1_0_QuantizedWeights` below for
quantize (bool): If True, return a quantized version of the model
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.ShuffleNet_V2_X1_0_QuantizedWeights``
Constructs a ShuffleNetV2 with 1.5x output channels, as described in
Constructs a ShuffleNetV2 with 1.5x output channels, as described in
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
<https://arxiv.org/abs/1807.11164>`_.
<https://arxiv.org/abs/1807.11164>`__.
.. note::
.. note::
Note that ``quantize = True`` returns a quantized model with 8 bit
Note that ``quantize = True`` returns a quantized model with 8 bit
...
@@ -280,10 +315,26 @@ def shufflenet_v2_x1_5(
...
@@ -280,10 +315,26 @@ def shufflenet_v2_x1_5(
GPU inference is not yet supported.
GPU inference is not yet supported.
Args:
Args:
weights (ShuffleNet_V2_X1_5_QuantizedWeights or ShuffleNet_V2_X1_5_Weights, optional): The pretrained
weights (:class:`~torchvision.models.quantization.ShuffleNet_V2_X1_5_QuantizedWeights` or :class:`~torchvision.models.ShuffleNet_V2_X1_5_Weights`, optional): The
weights for the model
pretrained weights for the model. See
progress (bool): If True, displays a progress bar of the download to stderr
:class:`~torchvision.models.quantization.ShuffleNet_V2_X1_5_QuantizedWeights` below for
quantize (bool): If True, return a quantized version of the model
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.ShuffleNet_V2_X1_5_QuantizedWeights``
Constructs a ShuffleNetV2 with 2.0x output channels, as described in
Constructs a ShuffleNetV2 with 2.0x output channels, as described in
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
<https://arxiv.org/abs/1807.11164>`_.
<https://arxiv.org/abs/1807.11164>`__.
.. note::
.. note::
Note that ``quantize = True`` returns a quantized model with 8 bit
Note that ``quantize = True`` returns a quantized model with 8 bit
...
@@ -309,10 +360,26 @@ def shufflenet_v2_x2_0(
...
@@ -309,10 +360,26 @@ def shufflenet_v2_x2_0(
GPU inference is not yet supported.
GPU inference is not yet supported.
Args:
Args:
weights (ShuffleNet_V2_X2_0_QuantizedWeights or ShuffleNet_V2_X2_0_Weights, optional): The pretrained
weights (:class:`~torchvision.models.quantization.ShuffleNet_V2_X2_0_QuantizedWeights` or :class:`~torchvision.models.ShuffleNet_V2_X2_0_Weights`, optional): The
weights for the model
pretrained weights for the model. See
progress (bool): If True, displays a progress bar of the download to stderr
:class:`~torchvision.models.quantization.ShuffleNet_V2_X2_0_QuantizedWeights` below for
quantize (bool): If True, return a quantized version of the model
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.ShuffleNet_V2_X2_0_QuantizedWeights``