Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
691a00e3
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
691a00e3
编写于
8月 02, 2017
作者:
Y
Yi Wang
提交者:
GitHub
8月 02, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3178 from reyoung/feature/GetEigenDeviceReturnReference
Return Reference Instead Pointer to GetEigenDevice
上级
26675bc6
02655a22
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
13 addition
and
15 deletion
+13
-15
paddle/framework/operator.cc
paddle/framework/operator.cc
+4
-4
paddle/framework/operator.h
paddle/framework/operator.h
+1
-1
paddle/operators/add_op.h
paddle/operators/add_op.h
+1
-2
paddle/operators/mean_op.h
paddle/operators/mean_op.h
+1
-1
paddle/operators/mul_op.h
paddle/operators/mul_op.h
+1
-1
paddle/operators/rowwise_add_op.h
paddle/operators/rowwise_add_op.h
+1
-1
paddle/operators/sgd_op.h
paddle/operators/sgd_op.h
+1
-1
paddle/operators/sigmoid_op.h
paddle/operators/sigmoid_op.h
+1
-2
paddle/operators/softmax_op.h
paddle/operators/softmax_op.h
+2
-2
未找到文件。
paddle/framework/operator.cc
浏览文件 @
691a00e3
...
...
@@ -20,16 +20,16 @@ namespace paddle {
namespace
framework
{
template
<
>
Eigen
::
DefaultDevice
*
ExecutionContext
::
GetEigenDevice
<
Eigen
::
DefaultDevice
&
ExecutionContext
::
GetEigenDevice
<
platform
::
CPUPlace
,
Eigen
::
DefaultDevice
>
()
const
{
return
device_context_
.
get_eigen_device
<
Eigen
::
DefaultDevice
>
();
return
*
device_context_
.
get_eigen_device
<
Eigen
::
DefaultDevice
>
();
}
#ifndef PADDLE_ONLY_CPU
template
<
>
Eigen
::
GpuDevice
*
Eigen
::
GpuDevice
&
ExecutionContext
::
GetEigenDevice
<
platform
::
GPUPlace
,
Eigen
::
GpuDevice
>
()
const
{
return
device_context_
.
get_eigen_device
<
Eigen
::
GpuDevice
>
();
return
*
device_context_
.
get_eigen_device
<
Eigen
::
GpuDevice
>
();
}
#endif
...
...
paddle/framework/operator.h
浏览文件 @
691a00e3
...
...
@@ -253,7 +253,7 @@ class ExecutionContext : public OperatorContext {
template
<
typename
PlaceType
,
typename
DeviceType
=
typename
EigenDeviceConverter
<
PlaceType
>::
EigenDeviceType
>
DeviceType
*
GetEigenDevice
()
const
;
DeviceType
&
GetEigenDevice
()
const
;
platform
::
Place
GetPlace
()
const
{
return
device_context_
.
GetPlace
();
}
...
...
paddle/operators/add_op.h
浏览文件 @
691a00e3
...
...
@@ -28,8 +28,7 @@ public:
output
->
mutable_data
<
T
>
(
context
.
GetPlace
());
EigenVector
<
T
>::
Flatten
(
*
output
).
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()))
=
EigenVector
<
T
>::
Flatten
(
*
output
).
device
(
context
.
GetEigenDevice
<
Place
>
())
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
input0
)
+
framework
::
EigenVector
<
T
>::
Flatten
(
*
input1
);
}
...
...
paddle/operators/mean_op.h
浏览文件 @
691a00e3
...
...
@@ -27,7 +27,7 @@ public:
output
->
mutable_data
<
T
>
(
context
.
GetPlace
());
EigenScalar
<
T
>::
From
(
*
output
).
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()
))
=
EigenScalar
<
T
>::
From
(
*
output
).
device
(
context
.
GetEigenDevice
<
Place
>
(
))
=
EigenVector
<
T
>::
Flatten
(
*
input
).
mean
();
}
};
...
...
paddle/operators/mul_op.h
浏览文件 @
691a00e3
...
...
@@ -29,7 +29,7 @@ public:
auto
output
=
context
.
Output
<
Tensor
>
(
0
);
output
->
mutable_data
<
T
>
(
context
.
GetPlace
());
EigenMatrix
<
T
>::
From
(
*
output
).
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()
))
=
EigenMatrix
<
T
>::
From
(
*
output
).
device
(
context
.
GetEigenDevice
<
Place
>
(
))
=
EigenMatrix
<
T
>::
From
(
*
context
.
Input
<
Tensor
>
(
"X"
))
.
contract
(
EigenMatrix
<
T
>::
From
(
*
context
.
Input
<
Tensor
>
(
"Y"
)),
dim_pair
);
...
...
paddle/operators/rowwise_add_op.h
浏览文件 @
691a00e3
...
...
@@ -33,7 +33,7 @@ public:
const
int
rest_size
=
input
.
size
()
/
bias_size
;
Eigen
::
DSizes
<
int
,
1
>
one_d
(
input
.
size
());
Eigen
::
DSizes
<
int
,
1
>
bcast
(
rest_size
);
output
.
reshape
(
one_d
).
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()
))
=
output
.
reshape
(
one_d
).
device
(
context
.
GetEigenDevice
<
Place
>
(
))
=
input
.
reshape
(
one_d
)
+
bias
.
broadcast
(
bcast
).
reshape
(
one_d
);
}
};
...
...
paddle/operators/sgd_op.h
浏览文件 @
691a00e3
...
...
@@ -29,7 +29,7 @@ public:
param_out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
EigenVector
<
T
>::
Flatten
(
*
param_out
).
device
(
*
(
ctx
.
GetEigenDevice
<
Place
>
()
))
=
EigenVector
<
T
>::
Flatten
(
*
param_out
).
device
(
ctx
.
GetEigenDevice
<
Place
>
(
))
=
EigenVector
<
T
>::
Flatten
(
*
param
)
-
lr
*
EigenVector
<
T
>::
Flatten
(
*
grad
);
}
};
...
...
paddle/operators/sigmoid_op.h
浏览文件 @
691a00e3
...
...
@@ -27,8 +27,7 @@ public:
auto
output
=
context
.
Output
<
Tensor
>
(
0
);
output
->
mutable_data
<
T
>
(
context
.
GetPlace
());
EigenVector
<
T
>::
Flatten
(
*
output
).
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()))
=
EigenVector
<
T
>::
Flatten
(
*
output
).
device
(
context
.
GetEigenDevice
<
Place
>
())
=
1.0
/
(
1.0
+
(
-
1.0
*
EigenVector
<
T
>::
Flatten
(
*
input
)).
exp
());
}
};
...
...
paddle/operators/softmax_op.h
浏览文件 @
691a00e3
...
...
@@ -46,9 +46,9 @@ public:
.
reshape
(
batch_by_one
)
.
broadcast
(
one_by_class
));
softmax
.
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()
))
=
shifted_logits
.
exp
();
softmax
.
device
(
context
.
GetEigenDevice
<
Place
>
(
))
=
shifted_logits
.
exp
();
softmax
.
device
(
*
(
context
.
GetEigenDevice
<
Place
>
()
))
=
softmax
.
device
(
context
.
GetEigenDevice
<
Place
>
(
))
=
(
softmax
*
softmax
.
sum
(
along_class
)
.
inverse
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录