Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
76a74f1f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76a74f1f
编写于
1月 15, 2018
作者:
F
fengjiayi
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'remove_functor1' into dev_elementwise_max_min
上级
736842e4
6ee8a2e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
1 addition
and
40 deletion
+1
-40
paddle/operators/elementwise_add_op.h
paddle/operators/elementwise_add_op.h
+0
-18
paddle/operators/elementwise_div_op.h
paddle/operators/elementwise_div_op.h
+0
-1
paddle/operators/elementwise_mul_op.h
paddle/operators/elementwise_mul_op.h
+0
-1
paddle/operators/elementwise_op_function.h
paddle/operators/elementwise_op_function.h
+1
-2
paddle/operators/elementwise_sub_op.h
paddle/operators/elementwise_sub_op.h
+0
-18
未找到文件。
paddle/operators/elementwise_add_op.h
浏览文件 @
76a74f1f
...
...
@@ -81,23 +81,6 @@ struct ElementwiseAddGradFunctor {
}
};
template
<
typename
T
>
struct
ElementwiseAddOneGradFunctor
{
template
<
typename
Device
,
typename
X
,
typename
Y
,
typename
Z
,
typename
dX
,
typename
dY
,
typename
dZ
>
void
operator
()(
Device
d
,
X
x
,
Y
y
,
Z
z
,
dX
dx
,
dY
dy
,
dZ
dz
)
{
auto
dz_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dz
);
if
(
dx
)
{
auto
dx_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dx
);
dx_e
.
device
(
d
)
=
dz_e
;
}
if
(
dy
)
{
auto
dy_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dy
);
dy_e
.
device
(
d
)
=
dz_e
.
sum
();
}
}
};
template
<
typename
T
>
struct
ElementwiseAddBroadCastGradFunctor
{
template
<
typename
Device
,
typename
X
,
typename
Y
,
typename
Z
,
typename
dX
,
...
...
@@ -142,7 +125,6 @@ class ElementwiseAddGradKernel : public framework::OpKernel<T> {
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
ElementwiseGradCompute
<
DeviceContext
,
T
,
ElementwiseAddGradFunctor
<
T
>
,
ElementwiseAddOneGradFunctor
<
T
>
,
ElementwiseAddBroadCastGradFunctor
<
T
>
,
ElementwiseAddBroadCast2GradFunctor
<
T
>>
(
ctx
);
}
...
...
paddle/operators/elementwise_div_op.h
浏览文件 @
76a74f1f
...
...
@@ -107,7 +107,6 @@ class ElementwiseDivGradKernel : public framework::OpKernel<T> {
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
ElementwiseGradCompute
<
DeviceContext
,
T
,
ElementwiseDivGradFunctor
<
T
>
,
ElementwiseDivGradFunctor
<
T
>
,
ElementwiseDivBroadCastGradFunctor
<
T
>
,
ElementwiseDivBroadCast2GradFunctor
<
T
>>
(
ctx
);
}
...
...
paddle/operators/elementwise_mul_op.h
浏览文件 @
76a74f1f
...
...
@@ -106,7 +106,6 @@ class ElementwiseMulGradKernel : public framework::OpKernel<T> {
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
ElementwiseGradCompute
<
DeviceContext
,
T
,
ElementwiseMulGradFunctor
<
T
>
,
ElementwiseMulGradFunctor
<
T
>
,
ElementwiseMulBroadCastGradFunctor
<
T
>
,
ElementwiseMulBroadCast2GradFunctor
<
T
>>
(
ctx
);
}
...
...
paddle/operators/elementwise_op_function.h
浏览文件 @
76a74f1f
...
...
@@ -311,8 +311,7 @@ EIGEN_FUNCTOR(Mul, EIGEN_MUL);
EIGEN_FUNCTOR
(
Div
,
EIGEN_DIV
);
template
<
typename
DeviceContext
,
typename
T
,
typename
functor
,
typename
functor1
,
typename
broadcastfunctor
,
typename
broadcast2functor
>
typename
broadcastfunctor
,
typename
broadcast2functor
>
void
ElementwiseGradCompute
(
const
framework
::
ExecutionContext
&
ctx
)
{
using
Tensor
=
framework
::
Tensor
;
...
...
paddle/operators/elementwise_sub_op.h
浏览文件 @
76a74f1f
...
...
@@ -43,23 +43,6 @@ struct ElementwiseSubGradFunctor {
}
};
template
<
typename
T
>
struct
ElementwiseSubOneGradFunctor
{
template
<
typename
Device
,
typename
X
,
typename
Y
,
typename
Z
,
typename
dX
,
typename
dY
,
typename
dZ
>
void
operator
()(
Device
d
,
X
x
,
Y
y
,
Z
z
,
dX
dx
,
dY
dy
,
dZ
dz
)
{
auto
dz_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dz
);
if
(
dx
)
{
auto
dx_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dx
);
dx_e
.
device
(
d
)
=
dz_e
;
}
if
(
dy
)
{
auto
dy_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
dy
);
dy_e
.
device
(
d
)
=
(
-
1.0
)
*
dz_e
.
sum
();
}
}
};
template
<
typename
T
>
struct
ElementwiseSubBroadCastGradFunctor
{
template
<
typename
Device
,
typename
X
,
typename
Y
,
typename
Z
,
typename
dX
,
...
...
@@ -106,7 +89,6 @@ class ElementwiseSubGradKernel : public framework::OpKernel<T> {
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
ElementwiseGradCompute
<
DeviceContext
,
T
,
ElementwiseSubGradFunctor
<
T
>
,
ElementwiseSubOneGradFunctor
<
T
>
,
ElementwiseSubBroadCastGradFunctor
<
T
>
,
ElementwiseSubBroadCast2GradFunctor
<
T
>>
(
ctx
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录