Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
a38fc5e1
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看板
未验证
提交
a38fc5e1
编写于
11月 10, 2022
作者:
Z
zhangyikun02
提交者:
GitHub
11月 10, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conv2d_transpose and deformable_conv unrestricted some limit for xpu2, test=kunlun (#47837)
上级
cdd8c8ab
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
61 deletion
+56
-61
cmake/external/xpu.cmake
cmake/external/xpu.cmake
+2
-2
paddle/phi/kernels/xpu/conv_transpose_kernel.cc
paddle/phi/kernels/xpu/conv_transpose_kernel.cc
+20
-42
paddle/phi/kernels/xpu/deformable_conv_grad_kernel.cc
paddle/phi/kernels/xpu/deformable_conv_grad_kernel.cc
+10
-7
paddle/phi/kernels/xpu/deformable_conv_kernel.cc
paddle/phi/kernels/xpu/deformable_conv_kernel.cc
+13
-10
python/paddle/fluid/tests/unittests/xpu/test_conv2d_transpose_op_xpu.py
...fluid/tests/unittests/xpu/test_conv2d_transpose_op_xpu.py
+11
-0
未找到文件。
cmake/external/xpu.cmake
浏览文件 @
a38fc5e1
...
...
@@ -10,7 +10,7 @@ set(XPU_RT_LIB_NAME "libxpurt.so")
if
(
NOT DEFINED XPU_BASE_URL
)
set
(
XPU_BASE_URL_WITHOUT_DATE
"https://baidu-kunlun-product.su.bcebos.com/KL-SDK/klsdk-dev"
)
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL_WITHOUT_DATE
}
/202211
04
"
)
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL_WITHOUT_DATE
}
/202211
10
"
)
else
()
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL
}
"
)
endif
()
...
...
@@ -19,7 +19,7 @@ endif()
if
(
NOT DEFINED XPU_XDNN_BASE_URL
)
set
(
XPU_XDNN_BASE_URL_WITHOUT_DATE
"https://klx-sdk-release-public.su.bcebos.com/xdnn/dev"
)
set
(
XPU_XDNN_BASE_URL
"
${
XPU_XDNN_BASE_URL_WITHOUT_DATE
}
/2022110
3
"
)
set
(
XPU_XDNN_BASE_URL
"
${
XPU_XDNN_BASE_URL_WITHOUT_DATE
}
/2022110
9
"
)
else
()
set
(
XPU_XDNN_BASE_URL
"
${
XPU_XDNN_BASE_URL
}
"
)
endif
()
...
...
paddle/phi/kernels/xpu/conv_transpose_kernel.cc
浏览文件 @
a38fc5e1
...
...
@@ -72,52 +72,30 @@ void Conv2dTransposeKernel(const Context& ctx,
const
int
batch_size
=
static_cast
<
int
>
(
x
.
dims
()[
0
]);
const
int
img_yc
=
static_cast
<
int
>
(
x
.
dims
()[
1
]);
const
int
img_yh
=
static_cast
<
int
>
(
x
.
dims
()[
2
]);
const
int
img_yw
=
static_cast
<
int
>
(
x
.
dims
()[
3
]);
const
int
img_xc
=
static_cast
<
int
>
(
out
->
dims
()[
1
]);
const
int
img_xh
=
static_cast
<
int
>
(
out
->
dims
()[
2
]);
const
int
img_xw
=
static_cast
<
int
>
(
out
->
dims
()[
3
]);
{
std
::
vector
<
int
>
ksize_check
=
vector_extend
(
ksize
,
2
);
std
::
vector
<
int
>
stride_check
=
vector_extend
(
strides
,
2
);
std
::
vector
<
int
>
pad_check
=
vector_extend
(
paddings_
,
4
);
std
::
vector
<
int
>
dilation_check
=
vector_extend
(
dilations_
,
2
);
int
xh_check
=
(
img_yh
-
1
)
*
stride_check
[
0
]
-
pad_check
[
0
]
-
pad_check
[
1
]
+
(
dilation_check
[
0
]
*
(
ksize_check
[
0
]
-
1
)
+
1
);
int
xw_check
=
(
img_yw
-
1
)
*
stride_check
[
1
]
-
pad_check
[
2
]
-
pad_check
[
3
]
+
(
dilation_check
[
1
]
*
(
ksize_check
[
1
]
-
1
)
+
1
);
PADDLE_ENFORCE_EQ
(
xh_check
==
img_xh
&&
xw_check
==
img_xw
,
true
,
errors
::
InvalidArgument
(
(
"XPU output size check error in conv_transpose op."
)));
}
int
r
=
xpu
::
conv2d_transpose
<
float
,
float
,
float
,
int16_t
>
(
ctx
.
x_context
(),
x
.
data
<
float
>
(),
filter_
.
data
<
float
>
(),
out
->
data
<
float
>
(),
batch_size
,
img_yc
,
img_yh
,
img_yw
,
img_xc
,
ksize
,
strides
,
paddings_
,
dilations_
,
groups
,
nullptr
,
nullptr
,
nullptr
,
true
);
PADDLE_ENFORCE_XDNN_SUCCESS
(
r
,
"conv2d_transpose"
);
int
r
=
xpu
::
conv2d_transpose_v2
<
float
,
float
,
float
,
int16_t
>
(
ctx
.
x_context
(),
x
.
data
<
float
>
(),
filter_
.
data
<
float
>
(),
out
->
data
<
float
>
(),
batch_size
,
img_yc
,
img_xh
,
img_xw
,
img_xc
,
ksize
,
strides
,
paddings_
,
dilations_
,
groups
,
nullptr
,
nullptr
,
nullptr
,
true
);
PADDLE_ENFORCE_XDNN_SUCCESS
(
r
,
"conv2d_transpose_v2"
);
}
}
// namespace phi
...
...
paddle/phi/kernels/xpu/deformable_conv_grad_kernel.cc
浏览文件 @
a38fc5e1
...
...
@@ -54,21 +54,24 @@ void DeformableConvGradKernel(const Context& dev_ctx,
dmask_data
=
dev_ctx
.
template
Alloc
<
T
>(
mask_grad
);
}
PADDLE_ENFORCE_EQ
(
deformable_groups
==
1
,
true
,
errors
::
InvalidArgument
(
(
"XPU only support deformable_groups == 1 in deformable_conv op."
)));
if
(
phi
::
backends
::
xpu
::
get_xpu_version
(
dev_ctx
.
GetPlace
().
GetDeviceId
())
==
phi
::
backends
::
xpu
::
XPUVersion
::
XPU1
)
{
PADDLE_ENFORCE_EQ
(
deformable_groups
==
1
,
true
,
errors
::
InvalidArgument
((
"XPU1 only support deformable_groups == 1 in "
"deformable_conv_grad op."
)));
}
PADDLE_ENFORCE_EQ
(
groups
==
1
,
true
,
errors
::
InvalidArgument
(
(
"XPU only support groups == 1 in deformable_conv op."
)));
(
"XPU only support groups == 1 in deformable_conv
_grad
op."
)));
PADDLE_ENFORCE_EQ
(
filter
.
dims
()[
2
]
<=
8
&&
filter
.
dims
()[
3
]
<=
8
,
true
,
errors
::
InvalidArgument
(
"Filter high and weight should less than 8 on xpu "
"in deformable_conv op."
));
"in deformable_conv
_grad
op."
));
const
int
batch_size
=
static_cast
<
int
>
(
x
.
dims
()[
0
]);
std
::
vector
<
int64_t
>
output_shape_vec
(
phi
::
vectorize
(
out_grad
.
dims
()));
...
...
paddle/phi/kernels/xpu/deformable_conv_kernel.cc
浏览文件 @
a38fc5e1
...
...
@@ -34,16 +34,19 @@ void DeformableConvKernel(const Context& dev_ctx,
DenseTensor
*
out
)
{
dev_ctx
.
template
Alloc
<
T
>(
out
);
PADDLE_ENFORCE_EQ
(
deformable_groups
==
1
,
true
,
errors
::
InvalidArgument
(
(
"XPU only support deformable_groups == 1 in deformable_conv op."
)));
PADDLE_ENFORCE_EQ
(
groups
==
1
,
true
,
errors
::
InvalidArgument
(
(
"XPU only support groups == 1 in deformable_conv op."
)));
if
(
phi
::
backends
::
xpu
::
get_xpu_version
(
dev_ctx
.
GetPlace
().
GetDeviceId
())
==
phi
::
backends
::
xpu
::
XPUVersion
::
XPU1
)
{
PADDLE_ENFORCE_EQ
(
deformable_groups
==
1
,
true
,
errors
::
InvalidArgument
((
"XPU1 only support deformable_groups == 1 in "
"deformable_conv op."
)));
PADDLE_ENFORCE_EQ
(
groups
==
1
,
true
,
errors
::
InvalidArgument
(
(
"XPU1 only support groups == 1 in deformable_conv op."
)));
}
PADDLE_ENFORCE_EQ
(
filter
.
dims
()[
2
]
<=
8
&&
filter
.
dims
()[
3
]
<=
8
,
true
,
errors
::
InvalidArgument
(
...
...
python/paddle/fluid/tests/unittests/xpu/test_conv2d_transpose_op_xpu.py
浏览文件 @
a38fc5e1
...
...
@@ -280,6 +280,17 @@ class XPUTestConv2DTransposeOp(XPUOpTestWrapper):
f_c
=
self
.
input_size
[
1
]
self
.
filter_size
=
[
f_c
,
6
,
3
,
3
]
class
TestWithEvenUpsample
(
TestConv2DTransposeOp
):
def
init_test_case
(
self
):
self
.
pad
=
[
2
,
2
]
self
.
stride
=
[
2
,
2
]
self
.
groups
=
1
self
.
dilations
=
[
1
,
1
]
self
.
output_size
=
[
14
,
14
]
self
.
input_size
=
[
2
,
3
,
7
,
7
]
# NCHW
f_c
=
self
.
input_size
[
1
]
self
.
filter_size
=
[
f_c
,
6
,
5
,
5
]
support_types
=
get_xpu_op_support_types
(
'conv2d_transpose'
)
for
stype
in
support_types
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录