Skip to content
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
23 changes: 10 additions & 13 deletions python/paddle/nn/functional/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ def conv2d(
the number of output channels, g is the number of groups, kH is the filter's
height, kW is the filter's width.
bias (Tensor, optional): The bias with shape [M,].
stride (int|list|tuple): The stride size. It means the stride in convolution.
stride (int|list|tuple, optional): The stride size. It means the stride in convolution.
If stride is a list/tuple, it must contain two integers, (stride_height, stride_width).
Otherwise, stride_height = stride_width = stride. Default: stride = 1.
padding (string|int|list|tuple): The padding size. It means the number of zero-paddings
padding (string|int|list|tuple, optional): The padding size. It means the number of zero-paddings
on both sides for each dimension.If `padding` is a string, either 'VALID' or
'SAME' which is the padding algorithm. If padding size is a tuple or list,
it could be in three forms: `[pad_height, pad_width]` or
Expand All @@ -621,11 +621,11 @@ def conv2d(
when `data_format` is `"NHWC"`, `padding` can be in the form
`[[0,0], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]`.
Default: padding = 0.
dilation (int|list|tuple): The dilation size. It means the spacing between the kernel
dilation (int|list|tuple, optional): The dilation size. It means the spacing between the kernel
points. If dilation is a list/tuple, it must contain two integers, (dilation_height,
dilation_width). Otherwise, dilation_height = dilation_width = dilation.
Default: dilation = 1.
groups (int): The groups number of the Conv2D Layer. According to grouped
groups (int, optional): The groups number of the Conv2D Layer. According to grouped
convolution in Alex Krizhevsky's Deep CNN paper: when group=2,
the first half of the filters is only connected to the first half
of the input channels, while the second half of the filters is only
Expand All @@ -651,10 +651,9 @@ def conv2d(
w_var = paddle.randn((6, 3, 3, 3), dtype='float32')

y_var = F.conv2d(x_var, w_var)
y_np = y_var.numpy()

print(y_np.shape)
# (2, 6, 6, 6)
print(y_var.shape)
# [2, 6, 6, 6]
"""
# entry checks
if data_format not in ["NCHW", "NHWC"]:
Expand Down Expand Up @@ -1224,10 +1223,9 @@ def conv2d_transpose(
w_var = paddle.randn((3, 6, 3, 3), dtype='float32')

y_var = F.conv2d_transpose(x_var, w_var)
y_np = y_var.numpy()

print(y_np.shape)
# (2, 6, 10, 10)
print(y_var.shape)
# [2, 6, 10, 10]
"""

if data_format not in ['NCHW', 'NHWC']:
Expand Down Expand Up @@ -1513,10 +1511,9 @@ def conv3d(
w_var = paddle.randn((6, 3, 3, 3, 3), dtype='float32')

y_var = F.conv3d(x_var, w_var)
y_np = y_var.numpy()

print(y_np.shape)
# (2, 6, 6, 6, 6)
print(y_var.shape)
# [2, 6, 6, 6, 6]
"""
# entry check
if data_format not in ["NCDHW", "NDHWC"]:
Expand Down
21 changes: 9 additions & 12 deletions python/paddle/nn/layer/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class Conv1DTranspose(_ConvNd):
in_channels(int): The number of channels in the input image.
out_channels(int): The number of the filter. It is as same as the output
feature map.
kernel_size(int|tuple|list, optional): The filter size. If kernel_size is a tuple/list,
kernel_size(int|tuple|list): The filter size. If kernel_size is a tuple/list,
it must contain one integers, (kernel_size). None if
use output size to calculate kernel_size. Default: None. kernel_size and
output_size should not be None at the same time.
Expand Down Expand Up @@ -598,7 +598,7 @@ class Conv2D(_ConvNd):
Parameters:
in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple, optional): The size of the convolving kernel.
kernel_size(int|list|tuple): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. The default value is 1.
Expand Down Expand Up @@ -668,9 +668,8 @@ class Conv2D(_ConvNd):

conv = nn.Conv2D(4, 6, (3, 3))
y_var = conv(x_var)
y_np = y_var.numpy()
print(y_np.shape)
# (2, 6, 6, 6)
print(y_var.shape)
# [2, 6, 6, 6]
"""

def __init__(
Expand Down Expand Up @@ -841,9 +840,8 @@ class Conv2DTranspose(_ConvNd):

conv = nn.Conv2DTranspose(4, 6, (3, 3))
y_var = conv(x_var)
y_np = y_var.numpy()
print(y_np.shape)
# (2, 6, 10, 10)
print(y_var.shape)
# [2, 6, 10, 10]
"""

def __init__(
Expand Down Expand Up @@ -927,7 +925,7 @@ class Conv3D(_ConvNd):
Parameters:
in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple, optional): The size of the convolving kernel.
kernel_size(int|list|tuple): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
stride_D = stride_H = stride_W = stride. The default value is 1.
Expand Down Expand Up @@ -999,9 +997,8 @@ class Conv3D(_ConvNd):

conv = nn.Conv3D(4, 6, (3, 3, 3))
y_var = conv(x_var)
y_np = y_var.numpy()
print(y_np.shape)
# (2, 6, 6, 6, 6)
print(y_var.shape)
# [2, 6, 6, 6, 6]
"""

def __init__(
Expand Down