未验证 提交 f27d1bee 编写于 作者: C cnn 提交者: GitHub

rename conv_transposeXd-->convXd_transpose (#28198)

上级 7bfd799d
......@@ -92,7 +92,7 @@ class Conv1DTransposeTestCase(unittest.TestCase):
"weight", self.weight_shape, dtype=self.dtype)
b_var = fluid.data(
"bias", (self.out_channels, ), dtype=self.dtype)
y_var = F.conv_transpose1d(
y_var = F.conv1d_transpose(
x_var,
w_var,
None if self.no_bias else b_var,
......
......@@ -128,7 +128,7 @@ class Conv2DTransposeTestCase(unittest.TestCase):
else:
output_size = self.output_size
y_var = F.conv_transpose2d(
y_var = F.conv2d_transpose(
x_var,
w_var,
None if self.no_bias else b_var,
......
......@@ -119,7 +119,7 @@ class Conv3DTransposeTestCase(unittest.TestCase):
"weight", self.weight_shape, dtype=self.dtype)
b_var = fluid.data(
"bias", (self.num_filters, ), dtype=self.dtype)
y_var = F.conv_transpose3d(
y_var = F.conv3d_transpose(
x_var,
w_var,
None if self.no_bias else b_var,
......
......@@ -111,7 +111,7 @@ class TestFunctionalConv2D(TestCase):
"weight", self.weight.shape, dtype=self.dtype)
if not self.no_bias:
bias = fluid.data("bias", self.bias.shape, dtype=self.dtype)
y = F.conv_transpose2d(
y = F.conv2d_transpose(
x,
weight,
None if self.no_bias else bias,
......@@ -134,7 +134,7 @@ class TestFunctionalConv2D(TestCase):
x = dg.to_variable(self.input)
weight = dg.to_variable(self.weight)
bias = None if self.no_bias else dg.to_variable(self.bias)
y = F.conv_transpose2d(
y = F.conv2d_transpose(
x,
weight,
bias,
......@@ -215,7 +215,7 @@ class TestFunctionalConv2DError(TestCase):
"weight", self.weight_shape, dtype=self.dtype)
if not self.no_bias:
bias = fluid.data("bias", self.bias_shape, dtype=self.dtype)
y = F.conv_transpose2d(
y = F.conv2d_transpose(
x,
weight,
None if self.no_bias else bias,
......
......@@ -113,7 +113,7 @@ class TestFunctionalConv3DTranspose(TestCase):
"weight", self.weight.shape, dtype=self.dtype)
if not self.no_bias:
bias = fluid.data("bias", self.bias.shape, dtype=self.dtype)
y = F.conv_transpose3d(
y = F.conv3d_transpose(
x,
weight,
None if self.no_bias else bias,
......@@ -138,7 +138,7 @@ class TestFunctionalConv3DTranspose(TestCase):
x = dg.to_variable(self.input)
weight = dg.to_variable(self.weight)
bias = None if self.no_bias else dg.to_variable(self.bias)
y = F.conv_transpose3d(
y = F.conv3d_transpose(
x,
weight,
bias,
......@@ -222,7 +222,7 @@ class TestFunctionalConv3DTransposeError(TestCase):
"weight", self.weight_shape, dtype=self.dtype)
if not self.no_bias:
bias = fluid.data("bias", self.bias_shape, dtype=self.dtype)
y = F.conv_transpose3d(
y = F.conv3d_transpose(
x,
weight,
None if self.no_bias else bias,
......
......@@ -73,12 +73,12 @@ from .common import interpolate #DEFINE_ALIAS
from .common import upsample #DEFINE_ALIAS
from .common import bilinear #DEFINE_ALIAS
from .conv import conv1d #DEFINE_ALIAS
from .conv import conv_transpose1d #DEFINE_ALIAS
from .conv import conv1d_transpose #DEFINE_ALIAS
from .common import linear #DEFINE_ALIAS
from .conv import conv2d #DEFINE_ALIAS
from .conv import conv_transpose2d #DEFINE_ALIAS
from .conv import conv2d_transpose #DEFINE_ALIAS
from .conv import conv3d #DEFINE_ALIAS
from .conv import conv_transpose3d #DEFINE_ALIAS
from .conv import conv3d_transpose #DEFINE_ALIAS
# from .extension import add_position_encoding #DEFINE_ALIAS
# from .extension import autoincreased_step_counter #DEFINE_ALIAS
# from .extension import continuous_value_model #DEFINE_ALIAS
......
......@@ -15,11 +15,11 @@ from __future__ import print_function
__all__ = [
'conv1d',
'conv_transpose1d',
'conv1d_transpose',
'conv2d',
'conv_transpose2d',
'conv2d_transpose',
'conv3d',
'conv_transpose3d',
'conv3d_transpose',
]
import numpy as np
......@@ -541,7 +541,7 @@ def conv2d(x,
return out
def conv_transpose1d(x,
def conv1d_transpose(x,
weight,
bias=None,
stride=1,
......@@ -682,7 +682,7 @@ def conv_transpose1d(x,
[[4, 2]]]).astype(np.float32)
x_var = paddle.to_tensor(x)
w_var = paddle.to_tensor(w)
y_var = F.conv_transpose1d(x_var, w_var)
y_var = F.conv1d_transpose(x_var, w_var)
y_np = y_var.numpy()
print y_np
......@@ -802,7 +802,7 @@ def conv_transpose1d(x,
return out
def conv_transpose2d(x,
def conv2d_transpose(x,
weight,
bias=None,
stride=1,
......@@ -920,7 +920,7 @@ def conv_transpose2d(x,
None by default.
Returns:
A Tensor representing the conv_transpose2d, whose
A Tensor representing the conv2d_transpose, whose
data type is the same with input and shape is (num_batches, channels, out_h,
out_w) or (num_batches, out_h, out_w, channels). The tensor variable storing
transposed convolution result.
......@@ -946,7 +946,7 @@ def conv_transpose2d(x,
x_var = paddle.randn((2, 3, 8, 8), dtype='float32')
w_var = paddle.randn((3, 6, 3, 3), dtype='float32')
y_var = F.conv_transpose2d(x_var, w_var)
y_var = F.conv2d_transpose(x_var, w_var)
y_np = y_var.numpy()
print(y_np.shape)
......@@ -1242,7 +1242,7 @@ def conv3d(x,
return out
def conv_transpose3d(x,
def conv3d_transpose(x,
weight,
bias=None,
stride=1,
......@@ -1364,7 +1364,7 @@ def conv_transpose3d(x,
None by default.
Returns:
A Tensor representing the conv_transpose3d, whose data
A Tensor representing the conv3d_transpose, whose data
type is the same with input and shape is (num_batches, channels, out_d, out_h,
out_w) or (num_batches, out_d, out_h, out_w, channels). If act is None, the tensor
variable storing the transposed convolution result, and if act is not None, the tensor
......@@ -1391,7 +1391,7 @@ def conv_transpose3d(x,
x_var = paddle.randn((2, 3, 8, 8, 8), dtype='float32')
w_var = paddle.randn((3, 6, 3, 3, 3), dtype='float32')
y_var = F.conv_transpose3d(x_var, w_var)
y_var = F.conv3d_transpose(x_var, w_var)
y_np = y_var.numpy()
print(y_np.shape)
......
......@@ -427,7 +427,7 @@ class Conv1DTranspose(_ConvNd):
data_format=data_format)
def forward(self, x, output_size=None):
out = F.conv_transpose1d(
out = F.conv1d_transpose(
x,
self.weight,
bias=self.bias,
......@@ -748,7 +748,7 @@ class Conv2DTranspose(_ConvNd):
else:
output_padding = 0
out = F.conv_transpose2d(
out = F.conv2d_transpose(
x,
self.weight,
bias=self.bias,
......@@ -954,16 +954,16 @@ class Conv3DTranspose(_ConvNd):
**Note**:
The conv_transpose3d can be seen as the backward of the conv3d. For conv3d,
The conv3d_transpose can be seen as the backward of the conv3d. For conv3d,
when stride > 1, conv3d maps multiple input shape to the same output shape,
so for conv_transpose3d, when stride > 1, input shape maps multiple output shape.
so for conv3d_transpose, when stride > 1, input shape maps multiple output shape.
If output_size is None, :math:`H_{out} = H^\prime_{out}, :math:`H_{out} = \
H^\prime_{out}, W_{out} = W^\prime_{out}`; else, the :math:`D_{out}` of the output
size must between :math:`D^\prime_{out}` and :math:`D^\prime_{out} + strides[0]`,
the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}`
and :math:`H^\prime_{out} + strides[1]`, and the :math:`W_{out}` of the output size must
between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[2]`,
conv_transpose3d can compute the kernel size automatically.
conv3d_transpose can compute the kernel size automatically.
Parameters:
in_channels(int): The number of channels in the input image.
......@@ -1086,7 +1086,7 @@ class Conv3DTranspose(_ConvNd):
else:
output_padding = 0
out = F.conv_transpose3d(
out = F.conv3d_transpose(
x,
self.weight,
bias=self.bias,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册