diff --git a/docs/source/models/shufflenetv2.rst b/docs/source/models/shufflenetv2.rst new file mode 100644 index 00000000000..2cbe328ca8b --- /dev/null +++ b/docs/source/models/shufflenetv2.rst @@ -0,0 +1,27 @@ +ShuffleNet V2 +============= + +.. currentmodule:: torchvision.models + +The ShuffleNet V2 model is based on the `ShuffleNet V2: Practical Guidelines for Efficient +CNN Architecture Design `__ paper. + + +Model builders +-------------- + +The following model builders can be used to instantiate a ShuffleNetV2 model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.shufflenetv2.ShuffleNetV2`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + shufflenet_v2_x0_5 + shufflenet_v2_x1_0 + shufflenet_v2_x1_5 + shufflenet_v2_x2_0 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index f217028412a..2302691d39a 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -48,6 +48,7 @@ weights: models/regnet models/resnet models/resnext + models/shufflenetv2 models/squeezenet models/swin_transformer models/vgg diff --git a/torchvision/models/shufflenetv2.py b/torchvision/models/shufflenetv2.py index 5e58c489ee0..dc8efbc670d 100644 --- a/torchvision/models/shufflenetv2.py +++ b/torchvision/models/shufflenetv2.py @@ -261,13 +261,25 @@ def shufflenet_v2_x0_5( *, weights: Optional[ShuffleNet_V2_X0_5_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: """ - Constructs a ShuffleNetV2 with 0.5x output channels, as described in - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" - `_. + Constructs a ShuffleNetV2 architecture with 0.5x output channels, as described in + `ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design + `__. Args: - weights (ShuffleNet_V2_X0_5_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.ShuffleNet_V2_X0_5_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.ShuffleNet_V2_X0_5_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.shufflenetv2.ShuffleNetV2`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.ShuffleNet_V2_X0_5_Weights + :members: """ weights = ShuffleNet_V2_X0_5_Weights.verify(weights) @@ -279,13 +291,25 @@ def shufflenet_v2_x1_0( *, weights: Optional[ShuffleNet_V2_X1_0_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: """ - Constructs a ShuffleNetV2 with 1.0x output channels, as described in - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" - `_. + Constructs a ShuffleNetV2 architecture with 1.0x output channels, as described in + `ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design + `__. Args: - weights (ShuffleNet_V2_X1_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.ShuffleNet_V2_X1_0_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.ShuffleNet_V2_X1_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.shufflenetv2.ShuffleNetV2`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.ShuffleNet_V2_X1_0_Weights + :members: """ weights = ShuffleNet_V2_X1_0_Weights.verify(weights) @@ -297,13 +321,25 @@ def shufflenet_v2_x1_5( *, weights: Optional[ShuffleNet_V2_X1_5_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: """ - Constructs a ShuffleNetV2 with 1.5x output channels, as described in - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" - `_. + Constructs a ShuffleNetV2 architecture with 1.5x output channels, as described in + `ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design + `__. Args: - weights (ShuffleNet_V2_X1_5_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.ShuffleNet_V2_X1_5_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.ShuffleNet_V2_X1_5_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.shufflenetv2.ShuffleNetV2`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.ShuffleNet_V2_X1_5_Weights + :members: """ weights = ShuffleNet_V2_X1_5_Weights.verify(weights) @@ -315,13 +351,25 @@ def shufflenet_v2_x2_0( *, weights: Optional[ShuffleNet_V2_X2_0_Weights] = None, progress: bool = True, **kwargs: Any ) -> ShuffleNetV2: """ - Constructs a ShuffleNetV2 with 2.0x output channels, as described in - `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" - `_. + Constructs a ShuffleNetV2 architecture with 2.0x output channels, as described in + `ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design + `__. Args: - weights (ShuffleNet_V2_X2_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.ShuffleNet_V2_X2_0_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.ShuffleNet_V2_X2_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.shufflenetv2.ShuffleNetV2`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.ShuffleNet_V2_X2_0_Weights + :members: """ weights = ShuffleNet_V2_X2_0_Weights.verify(weights)