Skip to content
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

[Doctest]fix No.163,164,166, test=docs_preview #56527

Merged
merged 6 commits into from
Sep 1, 2023
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
60 changes: 30 additions & 30 deletions python/paddle/vision/models/squeezenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ class SqueezeNet(nn.Layer):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import SqueezeNet
>>> import paddle
>>> from paddle.vision.models import SqueezeNet

# build v1.0 model
model = SqueezeNet(version='1.0')
>>> # build v1.0 model
>>> model = SqueezeNet(version='1.0')

# build v1.1 model
# model = SqueezeNet(version='1.1')
>>> # build v1.1 model
>>> # model = SqueezeNet(version='1.1')

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""

def __init__(self, version, num_classes=1000, with_pool=True):
Expand Down Expand Up @@ -233,20 +233,20 @@ def squeezenet1_0(pretrained=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import squeezenet1_0
>>> import paddle
>>> from paddle.vision.models import squeezenet1_0

# build model
model = squeezenet1_0()
>>> # build model
>>> model = squeezenet1_0()

# build model and load imagenet pretrained weight
# model = squeezenet1_0(pretrained=True)
>>> # build model and load imagenet pretrained weight
>>> # model = squeezenet1_0(pretrained=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
return _squeezenet('squeezenet1_0', '1.0', pretrained, **kwargs)

Expand All @@ -267,19 +267,19 @@ def squeezenet1_1(pretrained=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import squeezenet1_1
>>> import paddle
>>> from paddle.vision.models import squeezenet1_1

# build model
model = squeezenet1_1()
>>> # build model
>>> model = squeezenet1_1()

# build model and load imagenet pretrained weight
# model = squeezenet1_1(pretrained=True)
>>> # build model and load imagenet pretrained weight
>>> # model = squeezenet1_1(pretrained=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
return _squeezenet('squeezenet1_1', '1.1', pretrained, **kwargs)
100 changes: 50 additions & 50 deletions python/paddle/vision/models/vgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ class VGG(nn.Layer):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import VGG
from paddle.vision.models.vgg import make_layers
>>> import paddle
>>> from paddle.vision.models import VGG
>>> from paddle.vision.models.vgg import make_layers

vgg11_cfg = [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M']
>>> vgg11_cfg = [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M']

features = make_layers(vgg11_cfg)
>>> features = make_layers(vgg11_cfg)

vgg11 = VGG(features)
>>> vgg11 = VGG(features)

x = paddle.rand([1, 3, 224, 224])
out = vgg11(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = vgg11(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""

def __init__(self, features, num_classes=1000, with_pool=True):
Expand Down Expand Up @@ -212,20 +212,20 @@ def vgg11(pretrained=False, batch_norm=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import vgg11
>>> import paddle
>>> from paddle.vision.models import vgg11

# build model
model = vgg11()
>>> # build model
>>> model = vgg11()

# build vgg11 model with batch_norm
model = vgg11(batch_norm=True)
>>> # build vgg11 model with batch_norm
>>> model = vgg11(batch_norm=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
model_name = 'vgg11'
if batch_norm:
Expand All @@ -249,20 +249,20 @@ def vgg13(pretrained=False, batch_norm=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import vgg13
>>> import paddle
>>> from paddle.vision.models import vgg13

# build model
model = vgg13()
>>> # build model
>>> model = vgg13()

# build vgg13 model with batch_norm
model = vgg13(batch_norm=True)
>>> # build vgg13 model with batch_norm
>>> model = vgg13(batch_norm=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
model_name = 'vgg13'
if batch_norm:
Expand All @@ -286,20 +286,20 @@ def vgg16(pretrained=False, batch_norm=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import vgg16
>>> import paddle
>>> from paddle.vision.models import vgg16

# build model
model = vgg16()
>>> # build model
>>> model = vgg16()

# build vgg16 model with batch_norm
model = vgg16(batch_norm=True)
>>> # build vgg16 model with batch_norm
>>> model = vgg16(batch_norm=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
model_name = 'vgg16'
if batch_norm:
Expand All @@ -323,20 +323,20 @@ def vgg19(pretrained=False, batch_norm=False, **kwargs):
Examples:
.. code-block:: python

import paddle
from paddle.vision.models import vgg19
>>> import paddle
>>> from paddle.vision.models import vgg19

# build model
model = vgg19()
>>> # build model
>>> model = vgg19()

# build vgg19 model with batch_norm
model = vgg19(batch_norm=True)
>>> # build vgg19 model with batch_norm
>>> model = vgg19(batch_norm=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)
>>> x = paddle.rand([1, 3, 224, 224])
>>> out = model(x)

print(out.shape)
# [1, 1000]
>>> print(out.shape)
[1, 1000]
"""
model_name = 'vgg19'
if batch_norm:
Expand Down
Loading