Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
740d2dc1
Mace
项目概览
Xiaomi
/
Mace
通知
107
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看板
提交
740d2dc1
编写于
1月 15, 2019
作者:
P
Paul Idstein
提交者:
Liangliang He
1月 15, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support LeakyRelu conversion from tensorflow (#308)
* Support LeakyRelu conversion from tensorflow * Code style PEP8
上级
c23719f2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
1 deletion
+10
-1
mace/python/tools/converter_tool/tensorflow_converter.py
mace/python/tools/converter_tool/tensorflow_converter.py
+10
-1
未找到文件。
mace/python/tools/converter_tool/tensorflow_converter.py
浏览文件 @
740d2dc1
...
@@ -43,6 +43,7 @@ tf_dilations_str = 'dilations'
...
@@ -43,6 +43,7 @@ tf_dilations_str = 'dilations'
tf_data_format_str
=
'data_format'
tf_data_format_str
=
'data_format'
tf_kernel_str
=
'ksize'
tf_kernel_str
=
'ksize'
tf_epsilon_str
=
'epsilon'
tf_epsilon_str
=
'epsilon'
tf_alpha_str
=
'alpha'
tf_is_training_str
=
'is_training'
tf_is_training_str
=
'is_training'
tf_align_corners
=
'align_corners'
tf_align_corners
=
'align_corners'
tf_block_size
=
'block_size'
tf_block_size
=
'block_size'
...
@@ -71,6 +72,7 @@ TFSupportedOps = [
...
@@ -71,6 +72,7 @@ TFSupportedOps = [
'Rsqrt'
,
'Rsqrt'
,
'Equal'
,
'Equal'
,
'Relu'
,
'Relu'
,
'LeakyRelu'
,
'Relu6'
,
'Relu6'
,
'Tanh'
,
'Tanh'
,
'Sigmoid'
,
'Sigmoid'
,
...
@@ -191,7 +193,8 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -191,7 +193,8 @@ class TensorflowConverter(base_converter.ConverterInterface):
TFOpType
.
Relu
.
name
:
ActivationType
.
RELU
,
TFOpType
.
Relu
.
name
:
ActivationType
.
RELU
,
TFOpType
.
Relu6
.
name
:
ActivationType
.
RELUX
,
TFOpType
.
Relu6
.
name
:
ActivationType
.
RELUX
,
TFOpType
.
Tanh
.
name
:
ActivationType
.
TANH
,
TFOpType
.
Tanh
.
name
:
ActivationType
.
TANH
,
TFOpType
.
Sigmoid
.
name
:
ActivationType
.
SIGMOID
TFOpType
.
Sigmoid
.
name
:
ActivationType
.
SIGMOID
,
TFOpType
.
LeakyRelu
.
name
:
ActivationType
.
LEAKYRELU
,
}
}
def
__init__
(
self
,
option
,
src_model_file
):
def
__init__
(
self
,
option
,
src_model_file
):
...
@@ -217,6 +220,7 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -217,6 +220,7 @@ class TensorflowConverter(base_converter.ConverterInterface):
TFOpType
.
Rsqrt
.
name
:
self
.
convert_elementwise
,
TFOpType
.
Rsqrt
.
name
:
self
.
convert_elementwise
,
TFOpType
.
Equal
.
name
:
self
.
convert_elementwise
,
TFOpType
.
Equal
.
name
:
self
.
convert_elementwise
,
TFOpType
.
Relu
.
name
:
self
.
convert_activation
,
TFOpType
.
Relu
.
name
:
self
.
convert_activation
,
TFOpType
.
LeakyRelu
.
name
:
self
.
convert_activation
,
TFOpType
.
Relu6
.
name
:
self
.
convert_activation
,
TFOpType
.
Relu6
.
name
:
self
.
convert_activation
,
TFOpType
.
Tanh
.
name
:
self
.
convert_activation
,
TFOpType
.
Tanh
.
name
:
self
.
convert_activation
,
TFOpType
.
Sigmoid
.
name
:
self
.
convert_activation
,
TFOpType
.
Sigmoid
.
name
:
self
.
convert_activation
,
...
@@ -565,6 +569,11 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -565,6 +569,11 @@ class TensorflowConverter(base_converter.ConverterInterface):
limit_arg
=
op
.
arg
.
add
()
limit_arg
=
op
.
arg
.
add
()
limit_arg
.
name
=
MaceKeyword
.
mace_activation_max_limit_str
limit_arg
.
name
=
MaceKeyword
.
mace_activation_max_limit_str
limit_arg
.
f
=
6.0
limit_arg
.
f
=
6.0
elif
tf_op
.
type
==
TFOpType
.
LeakyRelu
.
name
:
alpha_arg
=
op
.
arg
.
add
()
alpha_arg
.
name
=
\
MaceKeyword
.
mace_activation_leakyrelu_coefficient_str
alpha_arg
.
f
=
tf_op
.
get_attr
(
tf_alpha_str
)
def
convert_fill
(
self
,
tf_op
):
def
convert_fill
(
self
,
tf_op
):
op
=
self
.
convert_general_op
(
tf_op
)
op
=
self
.
convert_general_op
(
tf_op
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录