From db9088be3eaf7763b000852b5c83c76e8f1aa1dd Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Fri, 17 Jun 2022 14:08:37 +0800 Subject: [PATCH] update ResNet en docs (#43523) * add `Returns` * refine en doc * refine parameter `pretrained`, test=document_fix --- python/paddle/vision/models/resnet.py | 83 ++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/python/paddle/vision/models/resnet.py b/python/paddle/vision/models/resnet.py index ba58fe7f57d..b1263f62dca 100644 --- a/python/paddle/vision/models/resnet.py +++ b/python/paddle/vision/models/resnet.py @@ -181,13 +181,16 @@ class ResNet(nn.Layer): Args: Block (BasicBlock|BottleneckBlock): block module of model. - depth (int, optional): layers of resnet, Default: 50. + depth (int, optional): layers of ResNet, Default: 50. width (int, optional): base width per convolution group for each convolution block, Default: 64. num_classes (int, optional): output dim of last fc layer. If num_classes <=0, last fc layer will not be defined. Default: 1000. with_pool (bool, optional): use pool before the last fc layer or not. Default: True. groups (int, optional): number of groups for each convolution block, Default: 1. + Returns: + ResNet model. An instance of :ref:`api_fluid_dygraph_Layer`. + Examples: .. code-block:: python @@ -330,7 +333,11 @@ def resnet18(pretrained=False, **kwargs): `"Deep Residual Learning for Image Recognition" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNet 18-layer model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -358,7 +365,11 @@ def resnet34(pretrained=False, **kwargs): `"Deep Residual Learning for Image Recognition" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNet 34-layer model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -386,7 +397,11 @@ def resnet50(pretrained=False, **kwargs): `"Deep Residual Learning for Image Recognition" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNet 50-layer model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -414,7 +429,11 @@ def resnet101(pretrained=False, **kwargs): `"Deep Residual Learning for Image Recognition" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNet 101-layer. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -442,7 +461,11 @@ def resnet152(pretrained=False, **kwargs): `"Deep Residual Learning for Image Recognition" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNet 152-layer model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -470,7 +493,11 @@ def resnext50_32x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-50 32x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -500,7 +527,11 @@ def resnext50_64x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-50 64x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -530,7 +561,11 @@ def resnext101_32x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-101 32x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -561,7 +596,11 @@ def resnext101_64x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-101 64x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -592,7 +631,11 @@ def resnext152_32x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-152 32x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -623,7 +666,11 @@ def resnext152_64x4d(pretrained=False, **kwargs): `"Aggregated Residual Transformations for Deep Neural Networks" `_ Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + ResNeXt-152 64x4d model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -654,7 +701,11 @@ def wide_resnet50_2(pretrained=False, **kwargs): `"Wide Residual Networks" `_. Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + Wide ResNet-50-2 model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python @@ -683,7 +734,11 @@ def wide_resnet101_2(pretrained=False, **kwargs): `"Wide Residual Networks" `_. Args: - pretrained (bool, optional): If True, returns a model pre-trained on ImageNet. Default: False. + pretrained (bool, optional): Whether to load pre-trained weights. If True, returns a model pre-trained + on ImageNet. Default: False. + + Returns: + Wide ResNet-101-2 model. An instance of :ref:`api_fluid_dygraph_Layer`. Examples: .. code-block:: python -- GitLab