Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
bbceb723
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
提交
bbceb723
编写于
10月 05, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine some codes
上级
48b080db
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
6 addition
and
19 deletion
+6
-19
paddle/framework/executor.cc
paddle/framework/executor.cc
+0
-10
paddle/framework/executor_test.cc
paddle/framework/executor_test.cc
+2
-0
paddle/framework/scope.cc
paddle/framework/scope.cc
+2
-7
paddle/operators/feed_op.cc
paddle/operators/feed_op.cc
+1
-1
paddle/operators/fetch_op.cc
paddle/operators/fetch_op.cc
+1
-1
未找到文件。
paddle/framework/executor.cc
浏览文件 @
bbceb723
...
@@ -74,16 +74,6 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope) {
...
@@ -74,16 +74,6 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope) {
for
(
auto
&
device_context
:
device_contexts_
)
{
for
(
auto
&
device_context
:
device_contexts_
)
{
device_context
->
Wait
();
device_context
->
Wait
();
}
}
// // print tensor value
// for (auto& var : block.vars()) {
// std::cout << var.name() << std::endl;
// auto v = scope->FindVar(var.name());
// const LoDTensor& t = v->Get<LoDTensor>();
// for (int i = 0; i < t.numel(); ++i) {
// std::cout << t.data<float>()[i] << " ";
// }
// std::cout << std::endl;
// }
}
}
}
// namespace framework
}
// namespace framework
...
...
paddle/framework/executor_test.cc
浏览文件 @
bbceb723
...
@@ -130,6 +130,7 @@ std::once_flag set_variable_flag;
...
@@ -130,6 +130,7 @@ std::once_flag set_variable_flag;
template
<
typename
T
>
template
<
typename
T
>
void
set_feed_variable
(
const
std
::
vector
<
std
::
vector
<
T
>>&
inputs
)
{
void
set_feed_variable
(
const
std
::
vector
<
std
::
vector
<
T
>>&
inputs
)
{
typedef
std
::
vector
<
paddle
::
framework
::
Tensor
>
FeedInputs
;
typedef
std
::
vector
<
paddle
::
framework
::
Tensor
>
FeedInputs
;
// Tensors in feed value variable will only be in CPUPlace
Variable
*
g_feed_value
=
GetScope
()
->
FindVar
(
"feed_value"
);
Variable
*
g_feed_value
=
GetScope
()
->
FindVar
(
"feed_value"
);
FeedInputs
&
feed_inputs
=
*
(
g_feed_value
->
GetMutable
<
FeedInputs
>
());
FeedInputs
&
feed_inputs
=
*
(
g_feed_value
->
GetMutable
<
FeedInputs
>
());
auto
size
=
inputs
.
size
();
auto
size
=
inputs
.
size
();
...
@@ -144,6 +145,7 @@ void set_feed_variable(const std::vector<std::vector<T>>& inputs) {
...
@@ -144,6 +145,7 @@ void set_feed_variable(const std::vector<std::vector<T>>& inputs) {
template
<
typename
T
>
template
<
typename
T
>
std
::
vector
<
std
::
vector
<
T
>>
get_fetch_variable
()
{
std
::
vector
<
std
::
vector
<
T
>>
get_fetch_variable
()
{
typedef
std
::
vector
<
paddle
::
framework
::
Tensor
>
FetchOutputs
;
typedef
std
::
vector
<
paddle
::
framework
::
Tensor
>
FetchOutputs
;
// Tensors in fetch value variable will only be in CPUPlace
Variable
*
g_fetch_value
=
GetScope
()
->
FindVar
(
"fetch_value"
);
Variable
*
g_fetch_value
=
GetScope
()
->
FindVar
(
"fetch_value"
);
FetchOutputs
&
fetch_outputs
=
*
(
g_fetch_value
->
GetMutable
<
FetchOutputs
>
());
FetchOutputs
&
fetch_outputs
=
*
(
g_fetch_value
->
GetMutable
<
FetchOutputs
>
());
...
...
paddle/framework/scope.cc
浏览文件 @
bbceb723
...
@@ -66,15 +66,10 @@ void Scope::DropKids() {
...
@@ -66,15 +66,10 @@ void Scope::DropKids() {
std
::
once_flag
feed_variable_flag
;
std
::
once_flag
feed_variable_flag
;
template
<
typename
T
,
typename
...
Args
>
std
::
unique_ptr
<
T
>
make_unique
(
Args
&&
...
args
)
{
return
std
::
unique_ptr
<
T
>
(
new
T
(
std
::
forward
<
Args
>
(
args
)...));
}
framework
::
Scope
*
GetScope
()
{
framework
::
Scope
*
GetScope
()
{
static
std
::
unique_ptr
<
framework
::
Scope
>
g_scope
=
static
std
::
unique_ptr
<
framework
::
Scope
>
g_scope
{
nullptr
};
make_unique
<
framework
::
Scope
>
();
std
::
call_once
(
feed_variable_flag
,
[
&
]()
{
std
::
call_once
(
feed_variable_flag
,
[
&
]()
{
g_scope
.
reset
(
new
framework
::
Scope
());
g_scope
->
NewVar
(
"feed_value"
);
g_scope
->
NewVar
(
"feed_value"
);
g_scope
->
NewVar
(
"fetch_value"
);
g_scope
->
NewVar
(
"fetch_value"
);
});
});
...
...
paddle/operators/feed_op.cc
浏览文件 @
bbceb723
...
@@ -33,7 +33,7 @@ class FeedOp : public framework::OperatorWithKernel {
...
@@ -33,7 +33,7 @@ class FeedOp : public framework::OperatorWithKernel {
auto
in_dim
=
tensors
[
col
].
dims
();
auto
in_dim
=
tensors
[
col
].
dims
();
ctx
->
SetOutputDim
(
"Out"
,
in_dim
);
ctx
->
SetOutputDim
(
"Out"
,
in_dim
);
// TODO(qijun) need to handle LodTensor later
// TODO(qijun)
:
need to handle LodTensor later
}
}
framework
::
DataType
IndicateDataType
(
framework
::
DataType
IndicateDataType
(
...
...
paddle/operators/fetch_op.cc
浏览文件 @
bbceb723
...
@@ -39,7 +39,7 @@ class FetchOp : public framework::OperatorWithKernel {
...
@@ -39,7 +39,7 @@ class FetchOp : public framework::OperatorWithKernel {
tmp
.
Resize
(
input_dim
);
tmp
.
Resize
(
input_dim
);
(
*
tensors
)[
col
].
Resize
(
input_dim
);
(
*
tensors
)[
col
].
Resize
(
input_dim
);
// TODO(qijun) need to handle LodTensor later
// TODO(qijun)
:
need to handle LodTensor later
}
}
framework
::
DataType
IndicateDataType
(
framework
::
DataType
IndicateDataType
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录