Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
834d1824
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,发现更多精彩内容 >>
提交
834d1824
编写于
5月 16, 2018
作者:
李
李寅
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix-concat-bug' into 'master'
Fix concat and slice aix < 0 bug. See merge request !485
上级
5f10b2c3
6898b44c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
5 deletion
+9
-5
mace/ops/deconv_2d_benchmark.cc
mace/ops/deconv_2d_benchmark.cc
+1
-1
mace/python/tools/converter_tool/caffe_converter.py
mace/python/tools/converter_tool/caffe_converter.py
+5
-2
mace/python/tools/converter_tool/tensorflow_converter.py
mace/python/tools/converter_tool/tensorflow_converter.py
+1
-0
mace/python/tools/converter_tool/transformer.py
mace/python/tools/converter_tool/transformer.py
+2
-2
未找到文件。
mace/ops/deconv_2d_benchmark.cc
浏览文件 @
834d1824
...
@@ -114,8 +114,8 @@ static void Deconv2d(int iters,
...
@@ -114,8 +114,8 @@ static void Deconv2d(int iters,
BM_DECONV_2D_##N##_##C##_##H##_##W##_##KH##_##KW##_##STRIDE##_##OH##_##OW##\
BM_DECONV_2D_##N##_##C##_##H##_##W##_##KH##_##KW##_##STRIDE##_##OH##_##OW##\
_##P##_##OC##_##TYPE##_##DEVICE)
_##P##_##OC##_##TYPE##_##DEVICE)
// TODO(liutuo): add cpu benchmark when optimized.
#define BM_DECONV_2D(N, C, H, W, KH, KW, S, OH, OW, P, OC) \
#define BM_DECONV_2D(N, C, H, W, KH, KW, S, OH, OW, P, OC) \
BM_DECONV_2D_MACRO(N, C, H, W, KH, KW, S, OH, OW, P, OC, float, CPU); \
BM_DECONV_2D_MACRO(N, C, H, W, KH, KW, S, OH, OW, P, OC, float, GPU); \
BM_DECONV_2D_MACRO(N, C, H, W, KH, KW, S, OH, OW, P, OC, float, GPU); \
BM_DECONV_2D_MACRO(N, C, H, W, KH, KW, S, OH, OW, P, OC, half, GPU);
BM_DECONV_2D_MACRO(N, C, H, W, KH, KW, S, OH, OW, P, OC, half, GPU);
...
...
mace/python/tools/converter_tool/caffe_converter.py
浏览文件 @
834d1824
...
@@ -482,6 +482,7 @@ class CaffeConverter(base_converter.ConverterInterface):
...
@@ -482,6 +482,7 @@ class CaffeConverter(base_converter.ConverterInterface):
axis_arg
.
i
=
param
.
axis
axis_arg
.
i
=
param
.
axis
elif
param
.
HasField
(
'concat_dim'
):
elif
param
.
HasField
(
'concat_dim'
):
axis_arg
.
i
=
param
.
concat_dim
axis_arg
.
i
=
param
.
concat_dim
axis_arg
.
i
=
4
+
axis_arg
.
i
if
axis_arg
.
i
<
0
else
axis_arg
.
i
mace_check
(
axis_arg
.
i
==
1
,
"only support concat at channel dimension"
)
mace_check
(
axis_arg
.
i
==
1
,
"only support concat at channel dimension"
)
def
convert_slice
(
self
,
caffe_op
):
def
convert_slice
(
self
,
caffe_op
):
...
@@ -490,7 +491,8 @@ class CaffeConverter(base_converter.ConverterInterface):
...
@@ -490,7 +491,8 @@ class CaffeConverter(base_converter.ConverterInterface):
if
caffe_op
.
layer
.
HasField
(
'slice_param'
):
if
caffe_op
.
layer
.
HasField
(
'slice_param'
):
param
=
caffe_op
.
layer
.
slice_param
param
=
caffe_op
.
layer
.
slice_param
mace_check
(
not
param
.
HasField
(
'axis'
)
or
param
.
axis
==
1
,
mace_check
(
not
param
.
HasField
(
'axis'
)
or
param
.
axis
==
1
or
param
.
axis
==
-
3
,
"Mace do not support slice with axis %d"
%
param
.
axis
)
"Mace do not support slice with axis %d"
%
param
.
axis
)
mace_check
(
len
(
param
.
slice_point
)
==
0
,
mace_check
(
len
(
param
.
slice_point
)
==
0
,
"Mace do not support slice with slice_point"
)
"Mace do not support slice with slice_point"
)
...
@@ -503,7 +505,8 @@ class CaffeConverter(base_converter.ConverterInterface):
...
@@ -503,7 +505,8 @@ class CaffeConverter(base_converter.ConverterInterface):
param
=
caffe_op
.
layer
.
inner_product_param
param
=
caffe_op
.
layer
.
inner_product_param
op
.
type
=
MaceOp
.
FullyConnected
.
name
op
.
type
=
MaceOp
.
FullyConnected
.
name
mace_check
(
param
.
axis
==
1
and
not
param
.
transpose
,
mace_check
((
param
.
axis
==
1
or
param
.
axis
==
-
3
)
and
not
param
.
transpose
,
"Do not support non-default axis and transpose"
)
"Do not support non-default axis and transpose"
)
mace_check
(
caffe_op
.
blobs
[
0
].
ndim
in
[
2
,
4
],
mace_check
(
caffe_op
.
blobs
[
0
].
ndim
in
[
2
,
4
],
"Unexpected fc weigth ndim."
)
"Unexpected fc weigth ndim."
)
...
...
mace/python/tools/converter_tool/tensorflow_converter.py
浏览文件 @
834d1824
...
@@ -404,6 +404,7 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -404,6 +404,7 @@ class TensorflowConverter(base_converter.ConverterInterface):
axis_arg
=
op
.
arg
.
add
()
axis_arg
=
op
.
arg
.
add
()
axis_arg
.
name
=
MaceKeyword
.
mace_axis_str
axis_arg
.
name
=
MaceKeyword
.
mace_axis_str
axis
=
tf_op
.
inputs
[
-
1
].
eval
().
astype
(
np
.
int32
)
axis
=
tf_op
.
inputs
[
-
1
].
eval
().
astype
(
np
.
int32
)
axis
=
4
+
axis
if
axis
<
0
else
axis
axis_arg
.
i
=
axis
axis_arg
.
i
=
axis
mace_check
(
axis
==
3
,
"only support concat at channel dimension"
)
mace_check
(
axis
==
3
,
"only support concat at channel dimension"
)
...
...
mace/python/tools/converter_tool/transformer.py
浏览文件 @
834d1824
...
@@ -459,7 +459,7 @@ class Transformer(base_converter.ConverterInterface):
...
@@ -459,7 +459,7 @@ class Transformer(base_converter.ConverterInterface):
padding_arg
.
i
=
ConverterUtil
.
get_arg
(
padding_arg
.
i
=
ConverterUtil
.
get_arg
(
op
,
MaceKeyword
.
mace_padding_str
).
i
op
,
MaceKeyword
.
mace_padding_str
).
i
elif
ConverterUtil
.
get_arg
(
elif
ConverterUtil
.
get_arg
(
op
,
MaceKeyword
.
mace_padding_values_str
)
\
op
,
MaceKeyword
.
mace_padding_values_str
)
\
is
not
None
:
is
not
None
:
padding_arg
=
wt_op
.
arg
.
add
()
padding_arg
=
wt_op
.
arg
.
add
()
padding_arg
.
name
=
MaceKeyword
.
mace_padding_values_str
padding_arg
.
name
=
MaceKeyword
.
mace_padding_values_str
...
@@ -687,7 +687,7 @@ class Transformer(base_converter.ConverterInterface):
...
@@ -687,7 +687,7 @@ class Transformer(base_converter.ConverterInterface):
or
op
.
type
==
MaceOp
.
Deconv2D
.
name
\
or
op
.
type
==
MaceOp
.
Deconv2D
.
name
\
or
op
.
type
==
MaceOp
.
DepthwiseConv2d
.
name
:
or
op
.
type
==
MaceOp
.
DepthwiseConv2d
.
name
:
if
ConverterUtil
.
get_arg
(
if
ConverterUtil
.
get_arg
(
op
,
MaceKeyword
.
mace_winograd_filter_transformed
)
\
op
,
MaceKeyword
.
mace_winograd_filter_transformed
)
\
is
None
:
is
None
:
filter
=
self
.
_consts
[
op
.
input
[
1
]]
filter
=
self
.
_consts
[
op
.
input
[
1
]]
filter_data
=
np
.
array
(
filter
.
float_data
).
reshape
(
filter_data
=
np
.
array
(
filter
.
float_data
).
reshape
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录