Skip to content

Add docs for SqueezeNet #5832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/source/models/squeezenet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SqueezeNet
==========

.. currentmodule:: torchvision.models

The SqueezeNet model is based on the `SqueezeNet: AlexNet-level accuracy with
50x fewer parameters and <0.5MB model size <https://arxiv.org/abs/1602.07360>`__
paper.


Model builders
--------------

The following model builders can be used to instanciate a SqueezeNet model, with or
without pre-trained weights. All the model builders internally rely on the
``torchvision.models.squeezenet.SqueezeNet`` base class. Please refer to the `source
code
<https://github.com/pytorch/vision/blob/main/torchvision/models/squeezenet.py>`_ for
more details about this class.

.. autosummary::
:toctree: generated/
:template: function.rst

squeezenet1_0
squeezenet1_1
1 change: 1 addition & 0 deletions docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ weights:
:maxdepth: 1

models/resnet
models/squeezenet
models/vgg


Expand Down
40 changes: 33 additions & 7 deletions torchvision/models/squeezenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,27 @@ class SqueezeNet1_1_Weights(WeightsEnum):
def squeezenet1_0(
*, weights: Optional[SqueezeNet1_0_Weights] = None, progress: bool = True, **kwargs: Any
) -> SqueezeNet:
r"""SqueezeNet model architecture from the `"SqueezeNet: AlexNet-level
accuracy with 50x fewer parameters and <0.5MB model size"
"""SqueezeNet model architecture from the `SqueezeNet: AlexNet-level
accuracy with 50x fewer parameters and <0.5MB model size
<https://arxiv.org/abs/1602.07360>`_ paper.

The required minimum input size of the model is 21x21.

Args:
weights (SqueezeNet1_0_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.SqueezeNet1_0_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.SqueezeNet1_0_Weights` 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.
**kwargs: parameters passed to the ``torchvision.models.squeezenet.SqueezeNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/squeezenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.SqueezeNet1_0_Weights
:members:
"""
weights = SqueezeNet1_0_Weights.verify(weights)
return _squeezenet("1_0", weights, progress, **kwargs)
Expand All @@ -176,15 +189,28 @@ def squeezenet1_0(
def squeezenet1_1(
*, weights: Optional[SqueezeNet1_1_Weights] = None, progress: bool = True, **kwargs: Any
) -> SqueezeNet:
r"""SqueezeNet 1.1 model from the `official SqueezeNet repo
"""SqueezeNet 1.1 model from the `official SqueezeNet repo
<https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1>`_.

SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters
than SqueezeNet 1.0, without sacrificing accuracy.
The required minimum input size of the model is 17x17.

Args:
weights (SqueezeNet1_1_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.SqueezeNet1_1_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.SqueezeNet1_1_Weights` 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.
**kwargs: parameters passed to the ``torchvision.models.squeezenet.SqueezeNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/squeezenet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.SqueezeNet1_1_Weights
:members:
"""
weights = SqueezeNet1_1_Weights.verify(weights)
return _squeezenet("1_1", weights, progress, **kwargs)