Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f07892b6
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
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看板
提交
f07892b6
编写于
6月 08, 2020
作者:
Z
zhaoying
提交者:
jackzhang235
6月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(bugfix): change cast dtype to int32 only when dtype is int64
上级
41c745da
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
22 deletion
+29
-22
lite/core/mir/int64_to_int32_pass.cc
lite/core/mir/int64_to_int32_pass.cc
+29
-22
未找到文件。
lite/core/mir/int64_to_int32_pass.cc
浏览文件 @
f07892b6
...
...
@@ -44,10 +44,12 @@ void Int64ToInt32Pass::Apply(const std::unique_ptr<SSAGraph>& graph) {
}
/*
some op decide data type beside input or output tensor from op_param:
3. fillconstant
4. FillConstantBatchSiz
5. uniformrandom
ops which has datatype param
1. cast
2. fillconstant
3. FillConstantBatchSiz
4. uniformrandom
5. assign
int64 input or output from arm kernels
1. argmax:
...
...
@@ -61,9 +63,16 @@ void Int64ToInt32Pass::Apply(const std::unique_ptr<SSAGraph>& graph) {
9. compare
10. ctc
may support int64
1. cast
2. concat
int64 input or output from x86 kernels
1. gather:
2. lookup_table
3. reshape
4. sequence_reshape
5. sequence_reverse
6. sequence_unpad
BOOL = 0;INT16 = 1;INT32 = 2;INT64 = 3;FP16 = 4;FP32 = 5;FP64 = 6;
SIZE_T = 19;UINT8 = 20;INT8 = 21;
*/
void
Int64ToInt32Pass
::
ChangeInt64ToInt32IfNeeded
(
Node
*
inst_node
)
{
...
...
@@ -76,24 +85,22 @@ void Int64ToInt32Pass::ChangeInt64ToInt32IfNeeded(Node* inst_node) {
auto
out_dtype
=
inst
.
op_info
()
->
GetAttr
<
int
>
(
"out_dtype"
);
VLOG
(
6
)
<<
"in_dtype : "
<<
in_dtype
;
VLOG
(
6
)
<<
"out_dtype : "
<<
out_dtype
;
// BOOL = 0;INT16 = 1;INT32 = 2;INT64 = 3;FP16 = 4;FP32 = 5;FP64 = 6;
// SIZE_T = 19;UINT8 = 20;INT8 = 21;
cpp
::
OpDesc
*
cast_opdesc
=
const_cast
<
OpInfo
*>
(
inst
.
op_info
());
cast_opdesc
->
SetAttr
<
int
>
(
"out_dtype"
,
2
);
cast_opdesc
->
SetAttr
<
int
>
(
"in_dtype"
,
2
);
if
(
in_dtype
==
3
)
{
// INT64
cast_opdesc
->
SetAttr
<
int
>
(
"in_dtype"
,
2
);
// INT32
}
if
(
out_dtype
==
3
)
{
// INT64
cast_opdesc
->
SetAttr
<
int
>
(
"out_dtype"
,
2
);
// INT32
}
}
if
(
op_type
==
"fill_constant"
)
{
CHECK
(
0
)
<<
"int64_to_int32 pass do not expect fill_constant op for now"
;
}
else
if
(
op_type
==
"uniform_random"
)
{
CHECK
(
0
)
<<
"int64_to_int32 pass do not expect uniform_random op for now"
;
// auto dtype = opdesc.GetAttr<int>("dtype");
// if (dtype == static_cast<int32_t>(lite::core::FluidType::INT64)) {
// opdesc.SetAttr<int>("dtype",static_cast<int32_t>(lite::core::FluidType::INT32);
// }
}
else
if
(
op_type
==
"fill_constant_batch_size_like"
)
{
CHECK
(
0
)
<<
"int64_to_int32 pass do not expect "
"fill_constant_batch_size_like op for now"
;
if
(
op_type
==
"fill_constant"
||
op_type
==
"fill_constant_batch_size_like"
||
op_type
==
"uniform_random"
||
op_type
==
"assign"
)
{
CHECK
(
inst
.
op_info
()
->
GetAttr
<
int
>
(
"dtype"
)
!=
3
)
<<
"mlu does not expect int64 "
<<
op_type
<<
" op"
;
}
for
(
auto
*
in
:
inst_node
->
inlinks
)
{
CHECK
(
in
->
IsRoleSet
());
CHECK
(
in
->
IsArg
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录