Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
9666979d
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9666979d
编写于
11月 23, 2022
作者:
C
ccrrong
提交者:
GitHub
11月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move conv2d_transpose and conv3d_transpose (#48198)
上级
32462c64
变更
18
展开全部
显示空白变更内容
内联
并排
Showing
18 changed file
with
804 addition
and
798 deletion
+804
-798
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+0
-727
python/paddle/fluid/tests/unittests/ir/inference/test_mkldnn_conv_bias_fuse_pass.py
...unittests/ir/inference/test_mkldnn_conv_bias_fuse_pass.py
+2
-1
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv3d_transpose_op.py
...ts/unittests/ir/inference/test_trt_conv3d_transpose_op.py
+3
-2
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
.../fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
+2
-1
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_quant_dequant_pass.py
...nittests/ir/inference/test_trt_conv_quant_dequant_pass.py
+1
-1
python/paddle/fluid/tests/unittests/mlu/test_conv2d_transposed_op_mlu.py
...luid/tests/unittests/mlu/test_conv2d_transposed_op_mlu.py
+13
-13
python/paddle/fluid/tests/unittests/npu/test_conv2d_transpose_op_npu.py
...fluid/tests/unittests/npu/test_conv2d_transpose_op_npu.py
+7
-7
python/paddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
...ddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
+2
-1
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
.../paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
+15
-15
python/paddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
...ddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
+2
-1
python/paddle/fluid/tests/unittests/test_conv3d_transpose_part2_op.py
...e/fluid/tests/unittests/test_conv3d_transpose_part2_op.py
+12
-11
python/paddle/fluid/tests/unittests/test_conv_transpose_nn_grad.py
...ddle/fluid/tests/unittests/test_conv_transpose_nn_grad.py
+5
-5
python/paddle/fluid/tests/unittests/test_functional_conv2d_transpose.py
...fluid/tests/unittests/test_functional_conv2d_transpose.py
+1
-1
python/paddle/fluid/tests/unittests/test_functional_conv3d_transpose.py
...fluid/tests/unittests/test_functional_conv3d_transpose.py
+2
-2
python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py
...luid/tests/unittests/test_imperative_load_static_param.py
+4
-4
python/paddle/fluid/tests/unittests/test_layers.py
python/paddle/fluid/tests/unittests/test_layers.py
+3
-3
python/paddle/static/nn/__init__.py
python/paddle/static/nn/__init__.py
+2
-2
python/paddle/static/nn/common.py
python/paddle/static/nn/common.py
+728
-1
未找到文件。
python/paddle/fluid/layers/nn.py
浏览文件 @
9666979d
此差异已折叠。
点击以展开。
python/paddle/fluid/tests/unittests/ir/inference/test_mkldnn_conv_bias_fuse_pass.py
浏览文件 @
9666979d
...
...
@@ -15,6 +15,7 @@
import
unittest
import
numpy
as
np
from
inference_pass_test
import
InferencePassTest
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.core
import
PassVersionChecker
...
...
@@ -173,7 +174,7 @@ class ConvTransposeMkldnnFusePassDialtionsGroupsTest(InferencePassTest):
initializer
=
fluid
.
initializer
.
Xavier
(
uniform
=
False
),
learning_rate
=
0.001
,
)
conv_out
=
fluid
.
layers
.
conv2d_transpose
(
conv_out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
num_filters
=
3
,
filter_size
=
3
,
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv3d_transpose_op.py
浏览文件 @
9666979d
...
...
@@ -15,6 +15,7 @@
import
unittest
import
numpy
as
np
from
inference_pass_test
import
InferencePassTest
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.core
import
PassVersionChecker
...
...
@@ -28,7 +29,7 @@ class TensorRTSubgraphPassConv3dTransposeTest(InferencePassTest):
data
=
fluid
.
data
(
name
=
"data"
,
shape
=
[
-
1
,
4
,
4
,
32
,
32
],
dtype
=
"float32"
)
conv_out
=
fluid
.
layers
.
conv3d_transpose
(
conv_out
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data
,
num_filters
=
self
.
conv_num_filters
,
filter_size
=
self
.
conv_filter_size
,
...
...
@@ -95,7 +96,7 @@ class DynamicShapeTensorRTSubgraphPassConv3dTransposeTest(InferencePassTest):
data
=
fluid
.
data
(
name
=
"data"
,
shape
=
[
-
1
,
6
,
-
1
,
-
1
,
-
1
],
dtype
=
"float32"
)
conv_out
=
fluid
.
layers
.
conv3d_transpose
(
conv_out
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data
,
num_filters
=
self
.
conv_num_filters
,
filter_size
=
self
.
conv_filter_size
,
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_pass.py
浏览文件 @
9666979d
...
...
@@ -16,6 +16,7 @@ import os
import
unittest
import
numpy
as
np
from
inference_pass_test
import
InferencePassTest
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.core
import
PassVersionChecker
...
...
@@ -109,7 +110,7 @@ class TensorRTSubgraphPassConvTransposeTest(InferencePassTest):
data
=
fluid
.
data
(
name
=
"data"
,
shape
=
[
-
1
,
6
,
64
,
64
],
dtype
=
"float32"
)
conv_out
=
fluid
.
layers
.
conv2d_transpose
(
conv_out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
num_filters
=
self
.
conv_num_filters
,
filter_size
=
self
.
conv_filter_size
,
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_conv_quant_dequant_pass.py
浏览文件 @
9666979d
...
...
@@ -237,7 +237,7 @@ class QuantDequantTensorRTSubgraphPassConvTransposeTest(QuantDequantTest):
data_reshape
=
paddle
.
reshape
(
self
.
data
,
shape
=
[
1
,
4
,
14
,
14
])
self
.
label
=
fluid
.
data
(
name
=
'label'
,
shape
=
[
1
,
1
],
dtype
=
'int64'
)
label_shape
=
paddle
.
reshape
(
self
.
label
,
shape
=
[
1
,
1
,
1
])
conv_out
=
fluid
.
layers
.
conv2d_transpose
(
conv_out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data_reshape
,
num_filters
=
self
.
conv_num_filters
,
filter_size
=
self
.
conv_filter_size
,
...
...
python/paddle/fluid/tests/unittests/mlu/test_conv2d_transposed_op_mlu.py
浏览文件 @
9666979d
...
...
@@ -499,21 +499,21 @@ class TestConv2DTransposeAPI(unittest.TestCase):
data2
=
fluid
.
layers
.
data
(
name
=
'data2'
,
shape
=
[
5
,
5
,
3
],
dtype
=
'float32'
)
out1
=
fluid
.
layers
.
conv2d_transpose
(
out1
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NCHW'
,
)
out2
=
fluid
.
layers
.
conv2d_transpose
(
out2
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NHWC'
,
)
out3
=
fluid
.
layers
.
conv2d_transpose
(
out3
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -521,7 +521,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
1
,
1
],
[
1
,
1
],
[
0
,
0
]],
data_format
=
'NHWC'
,
)
out4
=
fluid
.
layers
.
conv2d_transpose
(
out4
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
3
,
num_filters
=
6
,
...
...
@@ -529,7 +529,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
0
,
0
],
[
2
,
1
],
[
0
,
0
]],
data_format
=
'NCHW'
,
)
out5
=
fluid
.
layers
.
conv2d_transpose
(
out5
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -537,7 +537,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'SAME'
,
data_format
=
'NCHW'
,
)
out6
=
fluid
.
layers
.
conv2d_transpose
(
out6
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -545,7 +545,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'VALID'
,
data_format
=
'NHWC'
,
)
out7
=
fluid
.
layers
.
conv2d_transpose
(
out7
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -586,7 +586,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
data
=
fluid
.
layers
.
data
(
name
=
'data'
,
shape
=
[
3
,
5
,
5
],
dtype
=
"float32"
)
def
attr_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -597,7 +597,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_data_format
)
def
attr_padding_str
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -608,7 +608,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_str
)
def
attr_padding_list
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -619,7 +619,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_list
)
def
attr_padding_with_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -635,14 +635,14 @@ class TestConv2DTransposeOpException(unittest.TestCase):
)
def
error_input_size
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
error_input
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
)
self
.
assertRaises
(
ValueError
,
error_input_size
)
def
error_groups
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
0
,
num_filters
=
6
,
...
...
python/paddle/fluid/tests/unittests/npu/test_conv2d_transpose_op_npu.py
浏览文件 @
9666979d
...
...
@@ -435,21 +435,21 @@ class TestConv2DTransposeAPI(unittest.TestCase):
data2
=
fluid
.
layers
.
data
(
name
=
'data2'
,
shape
=
[
5
,
5
,
3
],
dtype
=
'float32'
)
out1
=
fluid
.
layers
.
conv2d_transpose
(
out1
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NCHW'
,
)
out2
=
fluid
.
layers
.
conv2d_transpose
(
out2
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NHWC'
,
)
out3
=
fluid
.
layers
.
conv2d_transpose
(
out3
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -457,7 +457,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
1
,
1
],
[
1
,
1
],
[
0
,
0
]],
data_format
=
'NHWC'
,
)
out4
=
fluid
.
layers
.
conv2d_transpose
(
out4
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
3
,
num_filters
=
6
,
...
...
@@ -465,7 +465,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
0
,
0
],
[
2
,
1
],
[
0
,
0
]],
data_format
=
'NCHW'
,
)
out5
=
fluid
.
layers
.
conv2d_transpose
(
out5
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -473,7 +473,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'SAME'
,
data_format
=
'NCHW'
,
)
out6
=
fluid
.
layers
.
conv2d_transpose
(
out6
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -481,7 +481,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'VALID'
,
data_format
=
'NHWC'
,
)
out7
=
fluid
.
layers
.
conv2d_transpose
(
out7
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
python/paddle/fluid/tests/unittests/test_conv2d_transpose_layer.py
浏览文件 @
9666979d
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
numpy
as
np
import
paddle
from
paddle
import
fluid
,
nn
import
paddle.fluid.dygraph
as
dg
import
paddle.nn.functional
as
F
...
...
@@ -104,7 +105,7 @@ class Conv2DTransposeTestCase(unittest.TestCase):
else
:
bias_attr
=
I
.
NumpyArrayInitializer
(
self
.
bias
)
y_var
=
fluid
.
layers
.
conv2d_transpose
(
y_var
=
paddle
.
static
.
nn
.
conv2d_transpose
(
x_var
,
self
.
num_filters
,
filter_size
=
self
.
filter_size
,
...
...
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
浏览文件 @
9666979d
...
...
@@ -835,21 +835,21 @@ class TestConv2DTransposeAPI(unittest.TestCase):
data2
=
fluid
.
layers
.
data
(
name
=
'data2'
,
shape
=
[
5
,
5
,
3
],
dtype
=
'float32'
)
out1
=
fluid
.
layers
.
conv2d_transpose
(
out1
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NCHW'
,
)
out2
=
fluid
.
layers
.
conv2d_transpose
(
out2
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NHWC'
,
)
out3
=
fluid
.
layers
.
conv2d_transpose
(
out3
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -857,7 +857,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
1
,
1
],
[
1
,
1
],
[
0
,
0
]],
data_format
=
'NHWC'
,
)
out4
=
fluid
.
layers
.
conv2d_transpose
(
out4
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
3
,
num_filters
=
6
,
...
...
@@ -865,7 +865,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
0
,
0
],
[
2
,
1
],
[
0
,
0
]],
data_format
=
'NCHW'
,
)
out5
=
fluid
.
layers
.
conv2d_transpose
(
out5
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -873,7 +873,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'SAME'
,
data_format
=
'NCHW'
,
)
out6
=
fluid
.
layers
.
conv2d_transpose
(
out6
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -881,7 +881,7 @@ class TestConv2DTransposeAPI(unittest.TestCase):
padding
=
'VALID'
,
data_format
=
'NHWC'
,
)
out7
=
fluid
.
layers
.
conv2d_transpose
(
out7
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -919,7 +919,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
data
=
fluid
.
layers
.
data
(
name
=
'data'
,
shape
=
[
3
,
5
,
5
],
dtype
=
"float32"
)
def
attr_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -930,7 +930,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_data_format
)
def
attr_padding_str
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -941,7 +941,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_str
)
def
attr_padding_list
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -952,7 +952,7 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_list
)
def
attr_padding_with_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -968,14 +968,14 @@ class TestConv2DTransposeOpException(unittest.TestCase):
)
def
error_input_size
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
error_input
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
)
self
.
assertRaises
(
ValueError
,
error_input_size
)
def
error_groups
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
0
,
num_filters
=
6
,
...
...
@@ -1064,7 +1064,7 @@ class TestTensorOutputSize3(TestTensorOutputSize1):
def
call_func
(
self
,
x
):
w_var
=
paddle
.
randn
((
3
,
6
,
3
,
3
),
dtype
=
'float32'
)
output_size
=
paddle
.
assign
([
17
])
out
=
paddle
.
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
x
,
num_filters
=
6
,
output_size
=
output_size
,
filter_size
=
3
,
stride
=
2
)
return
out
...
...
@@ -1076,7 +1076,7 @@ class TestTensorOutputSize4(TestTensorOutputSize1):
def
call_func
(
self
,
x
):
output_size
=
[
17
,
paddle
.
assign
([
17
])]
out
=
paddle
.
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
x
,
num_filters
=
6
,
output_size
=
output_size
,
filter_size
=
3
,
stride
=
2
)
return
out
...
...
python/paddle/fluid/tests/unittests/test_conv3d_transpose_layer.py
浏览文件 @
9666979d
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
numpy
as
np
import
paddle
from
paddle
import
fluid
,
nn
import
paddle.fluid.dygraph
as
dg
import
paddle.nn.functional
as
F
...
...
@@ -101,7 +102,7 @@ class Conv3DTransposeTestCase(unittest.TestCase):
bias_attr
=
False
else
:
bias_attr
=
I
.
NumpyArrayInitializer
(
self
.
bias
)
y_var
=
fluid
.
layers
.
conv3d_transpose
(
y_var
=
paddle
.
static
.
nn
.
conv3d_transpose
(
x_var
,
self
.
num_filters
,
filter_size
=
self
.
filter_size
,
...
...
python/paddle/fluid/tests/unittests/test_conv3d_transpose_part2_op.py
浏览文件 @
9666979d
...
...
@@ -15,6 +15,7 @@
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid.core
as
core
import
paddle.fluid
as
fluid
from
test_conv3d_transpose_op
import
TestConv3DTransposeOp
...
...
@@ -91,21 +92,21 @@ class TestConv3DTransposeAPI(unittest.TestCase):
name
=
'data2'
,
shape
=
[
5
,
5
,
5
,
3
],
dtype
=
'float32'
)
out1
=
fluid
.
layers
.
conv3d_transpose
(
out1
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NCDHW'
,
)
out2
=
fluid
.
layers
.
conv3d_transpose
(
out2
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
filter_size
=
3
,
data_format
=
'NDHWC'
,
)
out3
=
fluid
.
layers
.
conv3d_transpose
(
out3
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data1
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -113,7 +114,7 @@ class TestConv3DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
0
,
0
],
[
1
,
1
],
[
0
,
0
],
[
1
,
1
]],
data_format
=
'NCDHW'
,
)
out4
=
fluid
.
layers
.
conv3d_transpose
(
out4
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data2
,
groups
=
3
,
num_filters
=
6
,
...
...
@@ -121,7 +122,7 @@ class TestConv3DTransposeAPI(unittest.TestCase):
padding
=
[[
0
,
0
],
[
0
,
0
],
[
1
,
1
],
[
1
,
2
],
[
0
,
0
]],
data_format
=
'NDHWC'
,
)
out5
=
fluid
.
layers
.
conv3d_transpose
(
out5
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -129,7 +130,7 @@ class TestConv3DTransposeAPI(unittest.TestCase):
padding
=
'SAME'
,
data_format
=
'NCDHW'
,
)
out6
=
fluid
.
layers
.
conv3d_transpose
(
out6
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -137,7 +138,7 @@ class TestConv3DTransposeAPI(unittest.TestCase):
padding
=
'VALID'
,
data_format
=
'NDHWC'
,
)
out7
=
fluid
.
layers
.
conv3d_transpose
(
out7
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
data2
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -177,7 +178,7 @@ class TestConv3DTransposeOpException(unittest.TestCase):
)
def
attr_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -188,7 +189,7 @@ class TestConv3DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_data_format
)
def
attr_padding_str
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -199,7 +200,7 @@ class TestConv3DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_str
)
def
attr_padding_list
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
@@ -210,7 +211,7 @@ class TestConv3DTransposeOpException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
attr_padding_list
)
def
attr_padding_with_data_format
():
out
=
fluid
.
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
data
,
groups
=
1
,
num_filters
=
6
,
...
...
python/paddle/fluid/tests/unittests/test_conv_transpose_nn_grad.py
浏览文件 @
9666979d
...
...
@@ -36,7 +36,7 @@ class TestConvTransposeDoubleGradCheck(unittest.TestCase):
if
core
.
is_compiled_with_rocm
():
dtype
=
np
.
float32
x
=
layers
.
data
(
'x'
,
shape
,
False
,
dtype
)
y
=
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
x
,
2
,
filter_size
=
1
,
groups
=
1
,
bias_attr
=
False
)
x_arr
=
np
.
random
.
uniform
(
-
1
,
1
,
shape
).
astype
(
dtype
)
...
...
@@ -92,7 +92,7 @@ class TestConvTranspose2DoubleGradCheck_AsyPadding(
if
core
.
is_compiled_with_rocm
():
dtype
=
np
.
float32
x
=
layers
.
data
(
'x'
,
shape
,
False
,
dtype
)
y
=
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
x
,
num_filters
=
2
,
filter_size
=
1
,
...
...
@@ -145,7 +145,7 @@ class TestConvTranspose2DoubleGradCheck_PaddingSAME(
if
core
.
is_compiled_with_rocm
():
dtype
=
np
.
float32
x
=
layers
.
data
(
'x'
,
shape
,
False
,
dtype
)
y
=
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
x
,
num_filters
=
2
,
filter_size
=
1
,
...
...
@@ -198,7 +198,7 @@ class TestConvTranspose2DoubleGradCheck_PaddingVALID(
if
core
.
is_compiled_with_rocm
():
dtype
=
np
.
float32
x
=
layers
.
data
(
'x'
,
shape
,
False
,
dtype
)
y
=
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
x
,
num_filters
=
2
,
filter_size
=
1
,
...
...
@@ -251,7 +251,7 @@ class TestConvTranspose2DoubleGradCheck_ChannelLast(
if
core
.
is_compiled_with_rocm
():
dtype
=
np
.
float32
x
=
layers
.
data
(
'x'
,
shape
,
False
,
dtype
)
y
=
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
x
,
num_filters
=
2
,
filter_size
=
1
,
...
...
python/paddle/fluid/tests/unittests/test_functional_conv2d_transpose.py
浏览文件 @
9666979d
...
...
@@ -89,7 +89,7 @@ class TestFunctionalConv2D(TestCase):
(
-
1
,
self
.
in_channels
,
-
1
,
-
1
),
dtype
=
self
.
dtype
,
)
y
=
fluid
.
layers
.
conv2d_transpose
(
y
=
paddle
.
static
.
nn
.
conv2d_transpose
(
x
,
self
.
out_channels
,
output_size
=
self
.
output_size
,
...
...
python/paddle/fluid/tests/unittests/test_functional_conv3d_transpose.py
浏览文件 @
9666979d
...
...
@@ -89,7 +89,7 @@ class TestFunctionalConv3DTranspose(TestCase):
(
-
1
,
self
.
in_channels
,
-
1
,
-
1
,
-
1
),
dtype
=
self
.
dtype
,
)
y
=
fluid
.
layers
.
conv3d_transpose
(
y
=
paddle
.
static
.
nn
.
conv3d_transpose
(
x
,
self
.
out_channels
,
output_size
=
self
.
output_size
,
...
...
@@ -550,7 +550,7 @@ class TestFunctionalConv3DTransposeErrorCase10(TestCase):
with
fluid
.
unique_name
.
guard
():
with
fluid
.
program_guard
(
main
,
start
):
x
=
fluid
.
data
(
"input"
,
self
.
input
.
shape
,
dtype
=
paddle
.
float32
)
y
=
fluid
.
layers
.
conv3d_transpose
(
y
=
paddle
.
static
.
nn
.
conv3d_transpose
(
x
,
self
.
num_filters
,
self
.
filter_size
,
...
...
python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py
浏览文件 @
9666979d
...
...
@@ -103,20 +103,20 @@ class TestDygraphLoadStatic(unittest.TestCase):
name
=
"conv2d_trans_in"
,
shape
=
[
None
,
10
,
10
,
10
]
)
conv2d_trans_out_1
=
fluid
.
layers
.
conv2d_transpose
(
conv2d_trans_out_1
=
paddle
.
static
.
nn
.
conv2d_transpose
(
conv2d_trans_in
,
num_filters
=
10
,
filter_size
=
5
,
act
=
"relu"
)
conv2d_trans_out_2
=
fluid
.
layers
.
conv2d_transpose
(
conv2d_trans_out_2
=
paddle
.
static
.
nn
.
conv2d_transpose
(
conv2d_trans_in
,
num_filters
=
10
,
filter_size
=
5
,
act
=
"relu"
)
conv3d_trans_in
=
fluid
.
data
(
name
=
'conv3d_trans_in'
,
shape
=
[
None
,
3
,
12
,
32
,
32
],
dtype
=
'float32'
)
conv3d_trans_out_1
=
fluid
.
layers
.
conv3d_transpose
(
conv3d_trans_out_1
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
conv3d_trans_in
,
num_filters
=
2
,
filter_size
=
3
,
act
=
"relu"
)
conv3d_trans_out_2
=
fluid
.
layers
.
conv3d_transpose
(
conv3d_trans_out_2
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
conv3d_trans_in
,
num_filters
=
2
,
filter_size
=
3
,
act
=
"relu"
)
...
...
python/paddle/fluid/tests/unittests/test_layers.py
浏览文件 @
9666979d
...
...
@@ -716,7 +716,7 @@ class TestLayer(LayerTest):
inp_np
=
np
.
arange
(
0
,
24
).
reshape
([
2
,
3
,
2
,
2
]).
astype
(
'float32'
)
with
self
.
static_graph
():
img
=
layers
.
data
(
name
=
'pixel'
,
shape
=
[
3
,
2
,
2
],
dtype
=
'float32'
)
out
=
layers
.
conv2d_transpose
(
out
=
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
img
,
num_filters
=
10
,
filter_size
=
27
,
...
...
@@ -2270,7 +2270,7 @@ class TestLayer(LayerTest):
with
self
.
static_graph
():
img
=
layers
.
data
(
name
=
'pixel'
,
shape
=
[
3
,
2
,
2
,
2
],
dtype
=
'float32'
)
out
=
layers
.
conv3d_transpose
(
out
=
paddle
.
static
.
nn
.
conv3d_transpose
(
input
=
img
,
num_filters
=
12
,
filter_size
=
12
,
use_cudnn
=
False
)
static_rlt
=
self
.
get_static_graph_result
(
...
...
@@ -3062,7 +3062,7 @@ class TestBook(LayerTest):
fluid
.
default_main_program
(),
fluid
.
default_startup_program
()
):
img
=
self
.
_get_data
(
name
=
'pixel'
,
shape
=
[
3
,
2
,
2
],
dtype
=
'float32'
)
return
layers
.
conv2d_transpose
(
return
paddle
.
static
.
nn
.
conv2d_transpose
(
input
=
img
,
num_filters
=
10
,
output_size
=
28
)
...
...
python/paddle/static/nn/__init__.py
浏览文件 @
9666979d
...
...
@@ -14,15 +14,15 @@
from
.common
import
fc
# noqa: F401
from
.common
import
deform_conv2d
# noqa: F401
from
.common
import
conv2d_transpose
# noqa: F401
from
.common
import
conv3d_transpose
# noqa: F401
from
...fluid.layers
import
batch_norm
# noqa: F401
from
...fluid.layers
import
bilinear_tensor_product
# noqa: F401
from
...fluid.layers
import
case
# noqa: F401
from
...fluid.layers
import
cond
# noqa: F401
from
...fluid.layers
import
conv2d
# noqa: F401
from
...fluid.layers
import
conv2d_transpose
# noqa: F401
from
...fluid.layers
import
conv3d
# noqa: F401
from
...fluid.layers
import
conv3d_transpose
# noqa: F401
from
...fluid.layers
import
create_parameter
# noqa: F401
from
...fluid.layers
import
crf_decoding
# noqa: F401
from
...fluid.layers
import
data_norm
# noqa: F401
...
...
python/paddle/static/nn/common.py
浏览文件 @
9666979d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录