Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f27d1bee
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f27d1bee
编写于
10月 22, 2020
作者:
C
cnn
提交者:
GitHub
10月 22, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename conv_transposeXd-->convXd_transpose (#28198)
上级
7bfd799d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
29 deletion
+29
-29
python/paddle/fluid/tests/unittests/test_conv1d_transpose_layer.py
...ddle/fluid/tests/unittests/test_conv1d_transpose_layer.py
+1
-1
python/paddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
...ddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
+1
-1
python/paddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
...ddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
+1
-1
python/paddle/fluid/tests/unittests/test_functional_conv2d_transpose.py
...fluid/tests/unittests/test_functional_conv2d_transpose.py
+3
-3
python/paddle/fluid/tests/unittests/test_functional_conv3d_transpose.py
...fluid/tests/unittests/test_functional_conv3d_transpose.py
+3
-3
python/paddle/nn/functional/__init__.py
python/paddle/nn/functional/__init__.py
+3
-3
python/paddle/nn/functional/conv.py
python/paddle/nn/functional/conv.py
+11
-11
python/paddle/nn/layer/conv.py
python/paddle/nn/layer/conv.py
+6
-6
未找到文件。
python/paddle/fluid/tests/unittests/test_conv1d_transpose_layer.py
浏览文件 @
f27d1bee
...
...
@@ -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
.
conv
1d_transpose
(
x_var
,
w_var
,
None
if
self
.
no_bias
else
b_var
,
...
...
python/paddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
浏览文件 @
f27d1bee
...
...
@@ -128,7 +128,7 @@ class Conv2DTransposeTestCase(unittest.TestCase):
else
:
output_size
=
self
.
output_size
y_var
=
F
.
conv
_transpose2d
(
y_var
=
F
.
conv
2d_transpose
(
x_var
,
w_var
,
None
if
self
.
no_bias
else
b_var
,
...
...
python/paddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
浏览文件 @
f27d1bee
...
...
@@ -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
.
conv
3d_transpose
(
x_var
,
w_var
,
None
if
self
.
no_bias
else
b_var
,
...
...
python/paddle/fluid/tests/unittests/test_functional_conv2d_transpose.py
浏览文件 @
f27d1bee
...
...
@@ -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
.
conv
2d_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
.
conv
2d_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
.
conv
2d_transpose
(
x
,
weight
,
None
if
self
.
no_bias
else
bias
,
...
...
python/paddle/fluid/tests/unittests/test_functional_conv3d_transpose.py
浏览文件 @
f27d1bee
...
...
@@ -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
.
conv
3d_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
.
conv
3d_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
.
conv
3d_transpose
(
x
,
weight
,
None
if
self
.
no_bias
else
bias
,
...
...
python/paddle/nn/functional/__init__.py
浏览文件 @
f27d1bee
...
...
@@ -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
conv
1d_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
conv
2d_transpose
#DEFINE_ALIAS
from
.conv
import
conv3d
#DEFINE_ALIAS
from
.conv
import
conv
_transpose3d
#DEFINE_ALIAS
from
.conv
import
conv
3d_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
...
...
python/paddle/nn/functional/conv.py
浏览文件 @
f27d1bee
...
...
@@ -15,11 +15,11 @@ from __future__ import print_function
__all__
=
[
'conv1d'
,
'conv
_transpose1d
'
,
'conv
1d_transpose
'
,
'conv2d'
,
'conv
_transpose2d
'
,
'conv
2d_transpose
'
,
'conv3d'
,
'conv
_transpose3d
'
,
'conv
3d_transpose
'
,
]
import
numpy
as
np
...
...
@@ -541,7 +541,7 @@ def conv2d(x,
return
out
def
conv
_transpose1d
(
x
,
def
conv
1d_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.conv
1d_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
conv
2d_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 conv
2d_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.conv
2d_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
conv
3d_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 conv
3d_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.conv
3d_transpose
(x_var, w_var)
y_np = y_var.numpy()
print(y_np.shape)
...
...
python/paddle/nn/layer/conv.py
浏览文件 @
f27d1bee
...
...
@@ -427,7 +427,7 @@ class Conv1DTranspose(_ConvNd):
data_format
=
data_format
)
def
forward
(
self
,
x
,
output_size
=
None
):
out
=
F
.
conv
_transpose1d
(
out
=
F
.
conv
1d_transpose
(
x
,
self
.
weight
,
bias
=
self
.
bias
,
...
...
@@ -748,7 +748,7 @@ class Conv2DTranspose(_ConvNd):
else
:
output_padding
=
0
out
=
F
.
conv
_transpose2d
(
out
=
F
.
conv
2d_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 conv
3d_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 conv
3d_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.
conv
3d_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
.
conv
3d_transpose
(
x
,
self
.
weight
,
bias
=
self
.
bias
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录