Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
7bdc8a4d
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7bdc8a4d
编写于
6月 06, 2018
作者:
刘
刘琦
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix-eltwise-tranform-bug' into 'master'
fix scaler eltwise op tranform bug See merge request !558
上级
2b1defc7
e540cbaa
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
5 deletion
+19
-5
mace/ops/eltwise.h
mace/ops/eltwise.h
+1
-1
mace/ops/eltwise_test.cc
mace/ops/eltwise_test.cc
+4
-4
mace/python/tools/converter_tool/base_converter.py
mace/python/tools/converter_tool/base_converter.py
+1
-0
mace/python/tools/converter_tool/tensorflow_converter.py
mace/python/tools/converter_tool/tensorflow_converter.py
+13
-0
未找到文件。
mace/ops/eltwise.h
浏览文件 @
7bdc8a4d
...
@@ -30,7 +30,7 @@ class EltwiseOp : public Operator<D, T> {
...
@@ -30,7 +30,7 @@ class EltwiseOp : public Operator<D, T> {
static_cast
<
kernels
::
EltwiseType
>
(
OperatorBase
::
GetOptionalArg
<
int
>
(
static_cast
<
kernels
::
EltwiseType
>
(
OperatorBase
::
GetOptionalArg
<
int
>
(
"type"
,
static_cast
<
int
>
(
kernels
::
EltwiseType
::
NONE
))),
"type"
,
static_cast
<
int
>
(
kernels
::
EltwiseType
::
NONE
))),
OperatorBase
::
GetRepeatedArgs
<
float
>
(
"coeff"
),
OperatorBase
::
GetRepeatedArgs
<
float
>
(
"coeff"
),
OperatorBase
::
GetOptionalArg
<
float
>
(
"
x
"
,
1.0
))
{}
OperatorBase
::
GetOptionalArg
<
float
>
(
"
value
"
,
1.0
))
{}
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
const
Tensor
*
input0
=
this
->
Input
(
0
);
const
Tensor
*
input0
=
this
->
Input
(
0
);
...
...
mace/ops/eltwise_test.cc
浏览文件 @
7bdc8a4d
...
@@ -40,7 +40,7 @@ void SimpleTensorScalar(const kernels::EltwiseType type,
...
@@ -40,7 +40,7 @@ void SimpleTensorScalar(const kernels::EltwiseType type,
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
.
Input
(
"TInput"
)
.
Input
(
"TInput"
)
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddFloatArg
(
"
x
"
,
x
)
.
AddFloatArg
(
"
value
"
,
x
)
.
Output
(
"TOutput"
)
.
Output
(
"TOutput"
)
.
Finalize
(
net
.
NewOperatorDef
());
.
Finalize
(
net
.
NewOperatorDef
());
// Run
// Run
...
@@ -52,7 +52,7 @@ void SimpleTensorScalar(const kernels::EltwiseType type,
...
@@ -52,7 +52,7 @@ void SimpleTensorScalar(const kernels::EltwiseType type,
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
.
Input
(
"InputImg"
)
.
Input
(
"InputImg"
)
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddFloatArg
(
"
x
"
,
x
)
.
AddFloatArg
(
"
value
"
,
x
)
.
Output
(
"OutputImg"
)
.
Output
(
"OutputImg"
)
.
Finalize
(
net
.
NewOperatorDef
());
.
Finalize
(
net
.
NewOperatorDef
());
...
@@ -321,7 +321,7 @@ void RandomTensorScalar(const kernels::EltwiseType type,
...
@@ -321,7 +321,7 @@ void RandomTensorScalar(const kernels::EltwiseType type,
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
.
Input
(
"TInput"
)
.
Input
(
"TInput"
)
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddFloatArg
(
"
x
"
,
0.1
)
.
AddFloatArg
(
"
value
"
,
0.1
)
.
Output
(
"TOutput"
)
.
Output
(
"TOutput"
)
.
Finalize
(
net
.
NewOperatorDef
());
.
Finalize
(
net
.
NewOperatorDef
());
// Run
// Run
...
@@ -336,7 +336,7 @@ void RandomTensorScalar(const kernels::EltwiseType type,
...
@@ -336,7 +336,7 @@ void RandomTensorScalar(const kernels::EltwiseType type,
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
OpDefBuilder
(
"Eltwise"
,
"EltwiseTest"
)
.
Input
(
"InputImg"
)
.
Input
(
"InputImg"
)
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddIntArg
(
"type"
,
static_cast
<
int
>
(
type
))
.
AddFloatArg
(
"
x
"
,
0.1
)
.
AddFloatArg
(
"
value
"
,
0.1
)
.
Output
(
"OutputImg"
)
.
Output
(
"OutputImg"
)
.
AddIntArg
(
"T"
,
static_cast
<
int
>
(
DataTypeToEnum
<
T
>::
value
))
.
AddIntArg
(
"T"
,
static_cast
<
int
>
(
DataTypeToEnum
<
T
>::
value
))
.
Finalize
(
net
.
NewOperatorDef
());
.
Finalize
(
net
.
NewOperatorDef
());
...
...
mace/python/tools/converter_tool/base_converter.py
浏览文件 @
7bdc8a4d
...
@@ -139,6 +139,7 @@ class MaceKeyword(object):
...
@@ -139,6 +139,7 @@ class MaceKeyword(object):
mace_shape_str
=
'shape'
mace_shape_str
=
'shape'
mace_winograd_filter_transformed
=
'is_filter_transformed'
mace_winograd_filter_transformed
=
'is_filter_transformed'
mace_device
=
'device'
mace_device
=
'device'
mace_value_str
=
'value'
class
TransformerRule
(
Enum
):
class
TransformerRule
(
Enum
):
...
...
mace/python/tools/converter_tool/tensorflow_converter.py
浏览文件 @
7bdc8a4d
...
@@ -309,6 +309,19 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -309,6 +309,19 @@ class TensorflowConverter(base_converter.ConverterInterface):
type_arg
.
name
=
MaceKeyword
.
mace_element_type_str
type_arg
.
name
=
MaceKeyword
.
mace_element_type_str
type_arg
.
i
=
self
.
eltwise_type
[
tf_op
.
type
].
value
type_arg
.
i
=
self
.
eltwise_type
[
tf_op
.
type
].
value
if
len
(
tf_op
.
inputs
[
0
].
shape
)
==
0
:
value_arg
=
op
.
arg
.
add
()
value_arg
.
name
=
MaceKeyword
.
mace_value_str
value_arg
.
f
=
tf_op
.
inputs
[
0
].
eval
().
astype
(
np
.
float32
)
self
.
_skip_tensor
.
add
(
tf_op
.
inputs
[
0
].
name
)
del
op
.
input
[
0
]
elif
len
(
tf_op
.
inputs
[
1
].
shape
)
==
0
:
value_arg
=
op
.
arg
.
add
()
value_arg
.
name
=
MaceKeyword
.
mace_value_str
value_arg
.
f
=
tf_op
.
inputs
[
1
].
eval
().
astype
(
np
.
float32
)
self
.
_skip_tensor
.
add
(
tf_op
.
inputs
[
1
].
name
)
del
op
.
input
[
1
]
def
convert_biasadd
(
self
,
tf_op
):
def
convert_biasadd
(
self
,
tf_op
):
op
=
self
.
convert_general_op
(
tf_op
)
op
=
self
.
convert_general_op
(
tf_op
)
op
.
type
=
MaceOp
.
BiasAdd
.
name
op
.
type
=
MaceOp
.
BiasAdd
.
name
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录