Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9dde26f6
P
Paddle
项目概览
PaddlePaddle
/
Paddle
10 个月 前同步成功
通知
2286
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9dde26f6
编写于
12月 27, 2022
作者:
X
xiaoting
提交者:
GitHub
12月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fold for large bs (#49337)
* fix fold for large bs * fix fold for large bs
上级
17ec1620
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
10 deletion
+19
-10
paddle/phi/kernels/impl/fold_grad_kernel_impl.h
paddle/phi/kernels/impl/fold_grad_kernel_impl.h
+2
-5
paddle/phi/kernels/impl/fold_kernel_impl.h
paddle/phi/kernels/impl/fold_kernel_impl.h
+3
-5
python/paddle/fluid/tests/unittests/test_fold_op.py
python/paddle/fluid/tests/unittests/test_fold_op.py
+14
-0
未找到文件。
paddle/phi/kernels/impl/fold_grad_kernel_impl.h
浏览文件 @
9dde26f6
...
@@ -54,11 +54,8 @@ void FoldGradKernel(const Context& ctx,
...
@@ -54,11 +54,8 @@ void FoldGradKernel(const Context& ctx,
DDim
out_shape
=
DDim
out_shape
=
make_ddim
({
n_output_plane
,
output_sizes
[
0
],
output_sizes
[
1
]});
make_ddim
({
n_output_plane
,
output_sizes
[
0
],
output_sizes
[
1
]});
DDim
input_matrix_shape
=
make_ddim
({
x_dims
[
0
],
DDim
input_matrix_shape
=
make_ddim
(
kernel_sizes
[
0
],
{
1
,
kernel_sizes
[
0
],
kernel_sizes
[
1
],
output_height
,
output_width
});
kernel_sizes
[
1
],
output_height
,
output_width
});
phi
::
funcs
::
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
Context
,
T
>
im2col
;
phi
::
funcs
::
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
Context
,
T
>
im2col
;
...
...
paddle/phi/kernels/impl/fold_kernel_impl.h
浏览文件 @
9dde26f6
...
@@ -54,11 +54,8 @@ void FoldKernel(const Context& ctx,
...
@@ -54,11 +54,8 @@ void FoldKernel(const Context& ctx,
DDim
output_shape
=
DDim
output_shape
=
make_ddim
({
n_output_plane
,
output_sizes
[
0
],
output_sizes
[
1
]});
make_ddim
({
n_output_plane
,
output_sizes
[
0
],
output_sizes
[
1
]});
DDim
input_matrix_shape
=
make_ddim
({
x_dims
[
0
],
DDim
input_matrix_shape
=
make_ddim
(
kernel_sizes
[
0
],
{
1
,
kernel_sizes
[
0
],
kernel_sizes
[
1
],
output_height
,
output_width
});
kernel_sizes
[
1
],
output_height
,
output_width
});
phi
::
funcs
::
SetConstant
<
Context
,
T
>
set_zero
;
phi
::
funcs
::
SetConstant
<
Context
,
T
>
set_zero
;
set_zero
(
ctx
,
out
,
static_cast
<
T
>
(
0
));
set_zero
(
ctx
,
out
,
static_cast
<
T
>
(
0
));
...
@@ -66,6 +63,7 @@ void FoldKernel(const Context& ctx,
...
@@ -66,6 +63,7 @@ void FoldKernel(const Context& ctx,
for
(
int
i
=
0
;
i
<
batch_size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
batch_size
;
i
++
)
{
DenseTensor
out_batch
=
DenseTensor
out_batch
=
out
->
Slice
(
i
,
i
+
1
).
Resize
(
output_shape
);
// im size=3
out
->
Slice
(
i
,
i
+
1
).
Resize
(
output_shape
);
// im size=3
DenseTensor
in_batch
=
DenseTensor
in_batch
=
x
.
Slice
(
i
,
i
+
1
).
Resize
(
input_matrix_shape
);
// col size=5
x
.
Slice
(
i
,
i
+
1
).
Resize
(
input_matrix_shape
);
// col size=5
col2im
(
ctx
,
in_batch
,
dilations
,
strides
,
paddings
,
&
out_batch
);
col2im
(
ctx
,
in_batch
,
dilations
,
strides
,
paddings
,
&
out_batch
);
...
...
python/paddle/fluid/tests/unittests/test_fold_op.py
浏览文件 @
9dde26f6
...
@@ -130,6 +130,20 @@ class TestFoldOp(OpTest):
...
@@ -130,6 +130,20 @@ class TestFoldOp(OpTest):
self
.
check_grad
([
'X'
],
'Y'
,
check_eager
=
True
)
self
.
check_grad
([
'X'
],
'Y'
,
check_eager
=
True
)
class
TestFoldshape
(
TestFoldOp
):
def
init_data
(
self
):
self
.
batch_size
=
8
self
.
input_channels
=
3
*
3
*
3
self
.
length
=
6
self
.
kernel_sizes
=
[
3
,
3
]
self
.
strides
=
[
1
,
1
]
self
.
paddings
=
[
0
,
0
,
0
,
0
]
self
.
dilations
=
[
1
,
1
]
self
.
output_sizes
=
[
4
,
5
]
input_shape
=
[
self
.
batch_size
,
self
.
input_channels
,
self
.
length
]
self
.
x
=
np
.
random
.
rand
(
*
input_shape
).
astype
(
np
.
float64
)
class
TestFoldAPI
(
TestFoldOp
):
class
TestFoldAPI
(
TestFoldOp
):
# This is for test on paddle.nn.Fold
# This is for test on paddle.nn.Fold
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录