Skip to content

Commit f27d1be

Browse files
author
cnn
authored
rename conv_transposeXd-->convXd_transpose (#28198)
1 parent 7bfd799 commit f27d1be

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

python/paddle/fluid/tests/unittests/test_conv1d_transpose_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def functional(self, place):
9292
"weight", self.weight_shape, dtype=self.dtype)
9393
b_var = fluid.data(
9494
"bias", (self.out_channels, ), dtype=self.dtype)
95-
y_var = F.conv_transpose1d(
95+
y_var = F.conv1d_transpose(
9696
x_var,
9797
w_var,
9898
None if self.no_bias else b_var,

python/paddle/fluid/tests/unittests/test_conv2d_transpose_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def functional(self, place):
128128
else:
129129
output_size = self.output_size
130130

131-
y_var = F.conv_transpose2d(
131+
y_var = F.conv2d_transpose(
132132
x_var,
133133
w_var,
134134
None if self.no_bias else b_var,

python/paddle/fluid/tests/unittests/test_conv3d_transpose_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def functional(self, place):
119119
"weight", self.weight_shape, dtype=self.dtype)
120120
b_var = fluid.data(
121121
"bias", (self.num_filters, ), dtype=self.dtype)
122-
y_var = F.conv_transpose3d(
122+
y_var = F.conv3d_transpose(
123123
x_var,
124124
w_var,
125125
None if self.no_bias else b_var,

python/paddle/fluid/tests/unittests/test_functional_conv2d_transpose.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def static_graph_case_2(self):
111111
"weight", self.weight.shape, dtype=self.dtype)
112112
if not self.no_bias:
113113
bias = fluid.data("bias", self.bias.shape, dtype=self.dtype)
114-
y = F.conv_transpose2d(
114+
y = F.conv2d_transpose(
115115
x,
116116
weight,
117117
None if self.no_bias else bias,
@@ -134,7 +134,7 @@ def dygraph_case(self):
134134
x = dg.to_variable(self.input)
135135
weight = dg.to_variable(self.weight)
136136
bias = None if self.no_bias else dg.to_variable(self.bias)
137-
y = F.conv_transpose2d(
137+
y = F.conv2d_transpose(
138138
x,
139139
weight,
140140
bias,
@@ -215,7 +215,7 @@ def static_graph_case(self):
215215
"weight", self.weight_shape, dtype=self.dtype)
216216
if not self.no_bias:
217217
bias = fluid.data("bias", self.bias_shape, dtype=self.dtype)
218-
y = F.conv_transpose2d(
218+
y = F.conv2d_transpose(
219219
x,
220220
weight,
221221
None if self.no_bias else bias,

python/paddle/fluid/tests/unittests/test_functional_conv3d_transpose.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def static_graph_case_2(self):
113113
"weight", self.weight.shape, dtype=self.dtype)
114114
if not self.no_bias:
115115
bias = fluid.data("bias", self.bias.shape, dtype=self.dtype)
116-
y = F.conv_transpose3d(
116+
y = F.conv3d_transpose(
117117
x,
118118
weight,
119119
None if self.no_bias else bias,
@@ -138,7 +138,7 @@ def dygraph_case(self):
138138
x = dg.to_variable(self.input)
139139
weight = dg.to_variable(self.weight)
140140
bias = None if self.no_bias else dg.to_variable(self.bias)
141-
y = F.conv_transpose3d(
141+
y = F.conv3d_transpose(
142142
x,
143143
weight,
144144
bias,
@@ -222,7 +222,7 @@ def static_graph_case(self):
222222
"weight", self.weight_shape, dtype=self.dtype)
223223
if not self.no_bias:
224224
bias = fluid.data("bias", self.bias_shape, dtype=self.dtype)
225-
y = F.conv_transpose3d(
225+
y = F.conv3d_transpose(
226226
x,
227227
weight,
228228
None if self.no_bias else bias,

python/paddle/nn/functional/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@
7373
from .common import upsample #DEFINE_ALIAS
7474
from .common import bilinear #DEFINE_ALIAS
7575
from .conv import conv1d #DEFINE_ALIAS
76-
from .conv import conv_transpose1d #DEFINE_ALIAS
76+
from .conv import conv1d_transpose #DEFINE_ALIAS
7777
from .common import linear #DEFINE_ALIAS
7878
from .conv import conv2d #DEFINE_ALIAS
79-
from .conv import conv_transpose2d #DEFINE_ALIAS
79+
from .conv import conv2d_transpose #DEFINE_ALIAS
8080
from .conv import conv3d #DEFINE_ALIAS
81-
from .conv import conv_transpose3d #DEFINE_ALIAS
81+
from .conv import conv3d_transpose #DEFINE_ALIAS
8282
# from .extension import add_position_encoding #DEFINE_ALIAS
8383
# from .extension import autoincreased_step_counter #DEFINE_ALIAS
8484
# from .extension import continuous_value_model #DEFINE_ALIAS

python/paddle/nn/functional/conv.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
__all__ = [
1717
'conv1d',
18-
'conv_transpose1d',
18+
'conv1d_transpose',
1919
'conv2d',
20-
'conv_transpose2d',
20+
'conv2d_transpose',
2121
'conv3d',
22-
'conv_transpose3d',
22+
'conv3d_transpose',
2323
]
2424

2525
import numpy as np
@@ -541,7 +541,7 @@ def conv2d(x,
541541
return out
542542

543543

544-
def conv_transpose1d(x,
544+
def conv1d_transpose(x,
545545
weight,
546546
bias=None,
547547
stride=1,
@@ -682,7 +682,7 @@ def conv_transpose1d(x,
682682
[[4, 2]]]).astype(np.float32)
683683
x_var = paddle.to_tensor(x)
684684
w_var = paddle.to_tensor(w)
685-
y_var = F.conv_transpose1d(x_var, w_var)
685+
y_var = F.conv1d_transpose(x_var, w_var)
686686
y_np = y_var.numpy()
687687
print y_np
688688
@@ -802,7 +802,7 @@ def conv_transpose1d(x,
802802
return out
803803

804804

805-
def conv_transpose2d(x,
805+
def conv2d_transpose(x,
806806
weight,
807807
bias=None,
808808
stride=1,
@@ -920,7 +920,7 @@ def conv_transpose2d(x,
920920
None by default.
921921
922922
Returns:
923-
A Tensor representing the conv_transpose2d, whose
923+
A Tensor representing the conv2d_transpose, whose
924924
data type is the same with input and shape is (num_batches, channels, out_h,
925925
out_w) or (num_batches, out_h, out_w, channels). The tensor variable storing
926926
transposed convolution result.
@@ -946,7 +946,7 @@ def conv_transpose2d(x,
946946
x_var = paddle.randn((2, 3, 8, 8), dtype='float32')
947947
w_var = paddle.randn((3, 6, 3, 3), dtype='float32')
948948
949-
y_var = F.conv_transpose2d(x_var, w_var)
949+
y_var = F.conv2d_transpose(x_var, w_var)
950950
y_np = y_var.numpy()
951951
952952
print(y_np.shape)
@@ -1242,7 +1242,7 @@ def conv3d(x,
12421242
return out
12431243

12441244

1245-
def conv_transpose3d(x,
1245+
def conv3d_transpose(x,
12461246
weight,
12471247
bias=None,
12481248
stride=1,
@@ -1364,7 +1364,7 @@ def conv_transpose3d(x,
13641364
None by default.
13651365
13661366
Returns:
1367-
A Tensor representing the conv_transpose3d, whose data
1367+
A Tensor representing the conv3d_transpose, whose data
13681368
type is the same with input and shape is (num_batches, channels, out_d, out_h,
13691369
out_w) or (num_batches, out_d, out_h, out_w, channels). If act is None, the tensor
13701370
variable storing the transposed convolution result, and if act is not None, the tensor
@@ -1391,7 +1391,7 @@ def conv_transpose3d(x,
13911391
x_var = paddle.randn((2, 3, 8, 8, 8), dtype='float32')
13921392
w_var = paddle.randn((3, 6, 3, 3, 3), dtype='float32')
13931393
1394-
y_var = F.conv_transpose3d(x_var, w_var)
1394+
y_var = F.conv3d_transpose(x_var, w_var)
13951395
y_np = y_var.numpy()
13961396
13971397
print(y_np.shape)

python/paddle/nn/layer/conv.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def __init__(self,
427427
data_format=data_format)
428428

429429
def forward(self, x, output_size=None):
430-
out = F.conv_transpose1d(
430+
out = F.conv1d_transpose(
431431
x,
432432
self.weight,
433433
bias=self.bias,
@@ -748,7 +748,7 @@ def forward(self, x, output_size=None):
748748
else:
749749
output_padding = 0
750750

751-
out = F.conv_transpose2d(
751+
out = F.conv2d_transpose(
752752
x,
753753
self.weight,
754754
bias=self.bias,
@@ -954,16 +954,16 @@ class Conv3DTranspose(_ConvNd):
954954
955955
**Note**:
956956
957-
The conv_transpose3d can be seen as the backward of the conv3d. For conv3d,
957+
The conv3d_transpose can be seen as the backward of the conv3d. For conv3d,
958958
when stride > 1, conv3d maps multiple input shape to the same output shape,
959-
so for conv_transpose3d, when stride > 1, input shape maps multiple output shape.
959+
so for conv3d_transpose, when stride > 1, input shape maps multiple output shape.
960960
If output_size is None, :math:`H_{out} = H^\prime_{out}, :math:`H_{out} = \
961961
H^\prime_{out}, W_{out} = W^\prime_{out}`; else, the :math:`D_{out}` of the output
962962
size must between :math:`D^\prime_{out}` and :math:`D^\prime_{out} + strides[0]`,
963963
the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}`
964964
and :math:`H^\prime_{out} + strides[1]`, and the :math:`W_{out}` of the output size must
965965
between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[2]`,
966-
conv_transpose3d can compute the kernel size automatically.
966+
conv3d_transpose can compute the kernel size automatically.
967967
968968
Parameters:
969969
in_channels(int): The number of channels in the input image.
@@ -1086,7 +1086,7 @@ def forward(self, x, output_size=None):
10861086
else:
10871087
output_padding = 0
10881088

1089-
out = F.conv_transpose3d(
1089+
out = F.conv3d_transpose(
10901090
x,
10911091
self.weight,
10921092
bias=self.bias,

0 commit comments

Comments
 (0)