Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
8573ca54
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
8573ca54
编写于
8月 08, 2022
作者:
F
fwenguang
提交者:
GitHub
8月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MLU] fix bn_grad and hard_sigmoid_grad error (#44919)
上级
713c4d0d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
25 deletion
+21
-25
paddle/fluid/operators/activation_op_mlu.cc
paddle/fluid/operators/activation_op_mlu.cc
+4
-4
paddle/fluid/operators/batch_norm_op_mlu.cc
paddle/fluid/operators/batch_norm_op_mlu.cc
+1
-1
paddle/fluid/operators/conv_transpose_op_mlu.cc
paddle/fluid/operators/conv_transpose_op_mlu.cc
+12
-20
paddle/phi/kernels/funcs/activation_functor.h
paddle/phi/kernels/funcs/activation_functor.h
+4
-0
未找到文件。
paddle/fluid/operators/activation_op_mlu.cc
浏览文件 @
8573ca54
...
@@ -370,7 +370,7 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
...
@@ -370,7 +370,7 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
auto
*
dout
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Out"
));
auto
*
dout
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Out"
));
auto
*
out
=
ctx
.
Input
<
Tensor
>
(
"Out
"
);
auto
*
x
=
ctx
.
Input
<
Tensor
>
(
"X
"
);
auto
*
dx
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"X"
));
auto
*
dx
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"X"
));
float
slope
=
ctx
.
Attr
<
float
>
(
"slope"
);
float
slope
=
ctx
.
Attr
<
float
>
(
"slope"
);
float
offset
=
ctx
.
Attr
<
float
>
(
"offset"
);
float
offset
=
ctx
.
Attr
<
float
>
(
"offset"
);
...
@@ -381,7 +381,7 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
...
@@ -381,7 +381,7 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
1.0
f
/*sliced_dim useless*/
,
1.0
f
/*sliced_dim useless*/
,
slope
,
slope
,
offset
);
offset
);
MLUCnnlTensorDesc
out_desc
(
*
out
);
MLUCnnlTensorDesc
x_desc
(
*
x
);
MLUCnnlTensorDesc
dout_desc
(
*
dout
);
MLUCnnlTensorDesc
dout_desc
(
*
dout
);
MLUCnnlTensorDesc
dx_desc
(
*
dx
);
MLUCnnlTensorDesc
dx_desc
(
*
dx
);
MLUCnnl
::
ActiveGrad
(
ctx
,
MLUCnnl
::
ActiveGrad
(
ctx
,
...
@@ -392,8 +392,8 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
...
@@ -392,8 +392,8 @@ class HardSigmoidGradMLUKernel : public framework::OpKernel<T> {
nullptr
,
nullptr
,
dout_desc
.
get
(),
dout_desc
.
get
(),
GetBasePtr
(
dout
),
GetBasePtr
(
dout
),
out
_desc
.
get
(),
x
_desc
.
get
(),
GetBasePtr
(
out
),
GetBasePtr
(
x
),
dx_desc
.
get
(),
dx_desc
.
get
(),
GetBasePtr
(
dx
));
GetBasePtr
(
dx
));
}
}
...
...
paddle/fluid/operators/batch_norm_op_mlu.cc
浏览文件 @
8573ca54
...
@@ -273,7 +273,7 @@ class MLUBatchNormGradOpKernel : public framework::OpKernel<T> {
...
@@ -273,7 +273,7 @@ class MLUBatchNormGradOpKernel : public framework::OpKernel<T> {
const
auto
*
running_mean
=
ctx
.
Input
<
Tensor
>
(
"Mean"
);
const
auto
*
running_mean
=
ctx
.
Input
<
Tensor
>
(
"Mean"
);
const
auto
*
running_variance
=
ctx
.
Input
<
Tensor
>
(
"Variance"
);
const
auto
*
running_variance
=
ctx
.
Input
<
Tensor
>
(
"Variance"
);
MLUCnnl
::
FusedBatchNormGrad
(
ctx
,
MLUCnnl
::
FusedBatchNormGrad
(
ctx
,
tru
e
/*is_training*/
,
fals
e
/*is_training*/
,
transformed_desc
.
get
(),
transformed_desc
.
get
(),
GetBasePtr
(
&
transformed_d_y
),
GetBasePtr
(
&
transformed_d_y
),
transformed_desc
.
get
(),
transformed_desc
.
get
(),
...
...
paddle/fluid/operators/conv_transpose_op_mlu.cc
浏览文件 @
8573ca54
...
@@ -271,26 +271,18 @@ class Conv2DTransposeGradMLUKernel : public framework::OpKernel<T> {
...
@@ -271,26 +271,18 @@ class Conv2DTransposeGradMLUKernel : public framework::OpKernel<T> {
data_layout_mlu
,
data_layout_mlu
,
ToCnnlDataType
(
input_grad_tensor
.
dtype
()));
ToCnnlDataType
(
input_grad_tensor
.
dtype
()));
cnnlDataType_t
tensor_dtype
=
ToCnnlDataType
<
T
>
();
MLUCnnl
::
ConvolutionForward
(
ctx
,
cnnlDataType_t
dt_onchip
=
ToCnnlDataType
<
T
>
();
conv_desc
.
get
(),
MLUCnnl
::
Conv2D
(
ctx
,
nullptr
/*alpha*/
,
conv_desc
.
get
(),
nullptr
/*beta*/
,
tensor_dtype
,
nullptr
/*bias_desc*/
,
dt_onchip
,
nullptr
/*bias_ptr*/
,
nullptr
/* input_position */
,
output_grad_desc
.
get
(),
nullptr
/* input_scale */
,
GetBasePtr
(
&
output_grad_tensor
),
nullptr
/* input_offset */
,
trans_filter_desc
.
get
(),
nullptr
/* filter_position */
,
GetBasePtr
(
&
trans_filter
),
nullptr
/* filter_scale */
,
input_grad_desc
.
get
(),
nullptr
/* filter_offset */
,
GetBasePtr
(
&
input_grad_tensor
));
output_grad_desc
.
get
(),
GetBasePtr
(
&
output_grad_tensor
),
trans_filter_desc
.
get
(),
GetBasePtr
(
&
trans_filter
),
nullptr
/* bias_desc*/
,
nullptr
/* bias */
,
input_grad_desc
.
get
(),
GetBasePtr
(
&
input_grad_tensor
));
if
(
!
channel_last
)
{
if
(
!
channel_last
)
{
// transpose output from NHWC to NCHW
// transpose output from NHWC to NCHW
const
std
::
vector
<
int
>
perm_to_nchw
=
{
0
,
3
,
1
,
2
};
const
std
::
vector
<
int
>
perm_to_nchw
=
{
0
,
3
,
1
,
2
};
...
...
paddle/phi/kernels/funcs/activation_functor.h
浏览文件 @
8573ca54
...
@@ -1604,7 +1604,11 @@ struct HardSigmoidGradFunctor : public BaseActivationFunctor<T> {
...
@@ -1604,7 +1604,11 @@ struct HardSigmoidGradFunctor : public BaseActivationFunctor<T> {
}
}
static
constexpr
ActBwdOpFwdDeps
FwdDeps
()
{
static
constexpr
ActBwdOpFwdDeps
FwdDeps
()
{
#ifdef PADDLE_WITH_MLU
return
ActBwdOpFwdDeps
::
kDepX
;
#else
return
ActBwdOpFwdDeps
::
kDepOut
;
return
ActBwdOpFwdDeps
::
kDepOut
;
#endif
}
}
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录