Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
786d0946
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
786d0946
编写于
5月 07, 2020
作者:
J
jiaopu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add env param
上级
739b4ac1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
12 deletion
+22
-12
lite/kernels/mlu/bridges/graph.h
lite/kernels/mlu/bridges/graph.h
+6
-4
lite/kernels/mlu/subgraph_compute.h
lite/kernels/mlu/subgraph_compute.h
+16
-8
未找到文件。
lite/kernels/mlu/bridges/graph.h
浏览文件 @
786d0946
...
...
@@ -82,10 +82,12 @@ class Graph {
void
AddInput
(
std
::
shared_ptr
<
MLUTensor
>
tensor
)
{
inputs_
.
push_back
(
tensor
->
mlu_tensor
());
input_tensors_
.
push_back
(
tensor
);
constexpr
int
input_dimNb
=
4
;
bool
input_dim_mutable
[
4
]
=
{
true
,
false
,
false
,
false
};
cnmlSetTensorDimMutable
(
tensor
->
mlu_tensor
(),
input_dim_mutable
,
input_dimNb
);
if
(
GetBoolFromEnv
(
"BATCH_SIZE_CHANGEBLE"
))
{
constexpr
int
input_dimNb
=
4
;
bool
input_dim_mutable
[
4
]
=
{
true
,
false
,
false
,
false
};
cnmlSetTensorDimMutable
(
tensor
->
mlu_tensor
(),
input_dim_mutable
,
input_dimNb
);
}
}
void
AddOutput
(
std
::
shared_ptr
<
MLUTensor
>
tensor
)
{
...
...
lite/kernels/mlu/subgraph_compute.h
浏览文件 @
786d0946
...
...
@@ -81,9 +81,13 @@ class SubgraphEngine : public subgraph::Engine {
bool
InputShapeChanged
()
{
std
::
vector
<
std
::
vector
<
int64_t
>>
new_shape
;
for
(
auto
origin_itensor
:
origin_itensors_
)
{
auto
iv
=
origin_itensor
->
dims
().
Vectorize
();
iv
.
erase
(
iv
.
begin
());
new_shape
.
push_back
(
iv
);
if
(
GetBoolFromEnv
(
"BATCH_SIZE_CHANGEBLE"
))
{
auto
iv
=
origin_itensor
->
dims
().
Vectorize
();
iv
.
erase
(
iv
.
begin
());
new_shape
.
push_back
(
iv
);
}
else
{
new_shape
.
push_back
(
origin_itensor
->
dims
().
Vectorize
());
}
}
inputs_shape_
=
new_shape
;
if
(
shape_graph_map_
.
count
(
inputs_shape_
)
>
0
)
{
...
...
@@ -106,9 +110,13 @@ class SubgraphEngine : public subgraph::Engine {
for
(
auto
&
input_name
:
input_names_
)
{
auto
input_tensor
=
scope_
->
FindMutableTensor
(
input_name
);
origin_itensors_
.
push_back
(
input_tensor
);
auto
iv
=
input_tensor
->
dims
().
Vectorize
();
iv
.
erase
(
iv
.
begin
());
new_shape
.
push_back
(
iv
);
if
(
GetBoolFromEnv
(
"BATCH_SIZE_CHANGEBLE"
))
{
auto
iv
=
input_tensor
->
dims
().
Vectorize
();
iv
.
erase
(
iv
.
begin
());
new_shape
.
push_back
(
iv
);
}
else
{
new_shape
.
push_back
(
input_tensor
->
dims
().
Vectorize
());
}
CHECK
(
input_tensor
);
auto
input_node
=
graph
->
AddNode
(
input_name
,
...
...
@@ -239,7 +247,7 @@ class SubgraphEngine : public subgraph::Engine {
for
(
size_t
i
=
0
;
i
<
origin_itensors_
.
size
();
++
i
)
{
paddle
::
lite
::
subgraph
::
mlu
::
MLUTensor
tmp
(
origin_itensors_
[
i
]
->
dims
().
Vectorize
());
// graph_input->at(i)->get_origin_shape());
// graph_input->at(i)->get_origin_shape());
tmp
.
set_mlu_dtype
(
graph_input
->
at
(
i
)
->
dtype
());
tmp
.
set_mlu_ptr
(
const_cast
<
void
*>
(
origin_itensors_
[
i
]
->
raw_data
()));
graph_in
.
push_back
(
...
...
@@ -253,7 +261,7 @@ class SubgraphEngine : public subgraph::Engine {
Precision
>::
T
>
(
TARGET
(
kMLU
)));
paddle
::
lite
::
subgraph
::
mlu
::
MLUTensor
tmp
(
origin_otensors_
[
i
]
->
dims
().
Vectorize
());
// graph_output->at(i)->get_origin_shape());
// graph_output->at(i)->get_origin_shape());
tmp
.
set_mlu_dtype
(
graph_output
->
at
(
i
)
->
dtype
());
tmp
.
set_mlu_ptr
(
p_data
);
graph_out
.
push_back
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录