Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
孤小逸
Mace
提交
758fff83
Mace
项目概览
孤小逸
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
1
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
758fff83
编写于
6月 14, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add -Werror at op BUILD and fix warnings.
上级
65bb3630
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
62 addition
and
34 deletion
+62
-34
mace/core/future.h
mace/core/future.h
+11
-0
mace/kernels/eltwise.h
mace/kernels/eltwise.h
+8
-5
mace/kernels/stack.h
mace/kernels/stack.h
+3
-4
mace/kernels/strided_slice.h
mace/kernels/strided_slice.h
+1
-1
mace/kernels/winograd_transform.h
mace/kernels/winograd_transform.h
+2
-2
mace/ops/BUILD
mace/ops/BUILD
+12
-3
mace/ops/identity.h
mace/ops/identity.h
+1
-0
mace/ops/shape.h
mace/ops/shape.h
+1
-0
mace/ops/squeeze.h
mace/ops/squeeze.h
+1
-2
mace/ops/stack.h
mace/ops/stack.h
+0
-1
mace/ops/stack_test.cc
mace/ops/stack_test.cc
+2
-2
mace/tools/validation/BUILD
mace/tools/validation/BUILD
+8
-2
tools/converter.py
tools/converter.py
+12
-12
未找到文件。
mace/core/future.h
浏览文件 @
758fff83
...
...
@@ -30,6 +30,17 @@ struct StatsFuture {
};
};
inline
void
SetFutureDefaultWaitFn
(
StatsFuture
*
future
)
{
if
(
future
!=
nullptr
)
{
future
->
wait_fn
=
[](
CallStats
*
stats
)
{
if
(
stats
!=
nullptr
)
{
stats
->
start_micros
=
NowMicros
();
stats
->
end_micros
=
stats
->
start_micros
;
}
};
}
}
}
// namespace mace
#endif // MACE_CORE_FUTURE_H_
mace/kernels/eltwise.h
浏览文件 @
758fff83
...
...
@@ -652,11 +652,14 @@ struct EltwiseFunctor<DeviceType::CPU, float> : EltwiseFunctorBase {
static_cast
<
uint32_t
>
(
input0
->
dim_size
()
-
input1
->
dim_size
());
if
(
data_format_
==
NCHW
)
{
MACE_CHECK
(
input0
->
dim_size
()
==
4
&&
(
input1
->
dim_size
()
==
0
||
input1
->
dim_size
()
==
4
&&
input1
->
dim
(
1
)
==
input0
->
dim
(
1
)
&&
(
input1
->
dim
(
0
)
==
input0
->
dim
(
0
)
||
input1
->
dim
(
0
)
==
1
)
||
input1
->
dim_size
()
==
1
&&
input1
->
dim
(
0
)
==
input0
->
dim
(
1
)),
(
input0
->
dim_size
()
==
4
)
&&
((
input1
->
dim_size
()
==
0
)
||
(
input1
->
dim_size
()
==
4
&&
input1
->
dim
(
1
)
==
input0
->
dim
(
1
)
&&
(
input1
->
dim
(
0
)
==
input0
->
dim
(
0
)
||
input1
->
dim
(
0
)
==
1
))
||
(
input1
->
dim_size
()
==
1
&&
input1
->
dim
(
0
)
==
input0
->
dim
(
1
))),
"only support broadcast channel dimension"
);
}
else
{
if
(
rank_diff
>
0
&&
rank_diff
<
input0
->
dim_size
())
{
...
...
mace/kernels/stack.h
浏览文件 @
758fff83
...
...
@@ -34,8 +34,6 @@ struct StackFunctor {
MaceStatus
operator
()(
const
std
::
vector
<
const
Tensor
*>
&
inputs
,
Tensor
*
output
,
StatsFuture
*
future
)
{
MACE_UNUSED
(
future
);
MACE_CHECK
(
!
inputs
.
empty
(),
"stack inputs are empty."
);
std
::
vector
<
index_t
>
input_shape
=
inputs
[
0
]
->
shape
();
MACE_CHECK
(
axis_
>=
-
(
inputs
[
0
]
->
dim_size
()
+
1
)
&&
...
...
@@ -51,7 +49,7 @@ struct StackFunctor {
// On host, no need to map data
T
*
output_data
=
output
->
mutable_data
<
T
>
();
std
::
vector
<
const
T
*>
input_data
(
inputs
.
size
());
for
(
in
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
input_data
[
i
]
=
inputs
[
i
]
->
data
<
T
>
();
}
...
...
@@ -62,13 +60,14 @@ struct StackFunctor {
std
::
accumulate
(
input_shape
.
begin
()
+
axis_
,
input_shape
.
end
(),
1
,
std
::
multiplies
<
index_t
>
());
for
(
index_t
h
=
0
;
h
<
high_dim_elem_size
;
++
h
)
{
for
(
index
_t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
for
(
size
_t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
memcpy
(
output_data
,
input_data
[
i
]
+
h
*
low_dim_elem_size
,
sizeof
(
T
)
*
low_dim_elem_size
);
output_data
+=
low_dim_elem_size
;
}
}
SetFutureDefaultWaitFn
(
future
);
return
MACE_SUCCESS
;
}
...
...
mace/kernels/strided_slice.h
浏览文件 @
758fff83
...
...
@@ -45,7 +45,6 @@ struct StridedSliceFunctor {
const
Tensor
*
strides
,
Tensor
*
output
,
StatsFuture
*
future
)
{
MACE_UNUSED
(
future
);
MACE_CHECK
(
ellipsis_mask_
==
0
&&
new_axis_mask_
==
0
,
"ellipsis_mask and new_axis_mask are not supported yet."
);
...
...
@@ -144,6 +143,7 @@ struct StridedSliceFunctor {
}
}
SetFutureDefaultWaitFn
(
future
);
return
MACE_SUCCESS
;
}
...
...
mace/kernels/winograd_transform.h
浏览文件 @
758fff83
...
...
@@ -95,9 +95,9 @@ struct WinogradInverseTransformFunctorBase {
:
batch_
(
batch
),
height_
(
height
),
width_
(
width
),
wino_blk_size_
(
block_size
),
activation_
(
activation
),
relux_max_limit_
(
relux_max_limit
),
wino_blk_size_
(
block_size
)
{}
relux_max_limit_
(
relux_max_limit
)
{}
const
int
batch_
;
const
int
height_
;
...
...
mace/ops/BUILD
浏览文件 @
758fff83
...
...
@@ -41,7 +41,10 @@ cc_library(
[
"*.h"
],
exclude
=
[
"ops_test_util.h"
],
),
copts
=
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
copts
=
[
"-Werror"
,
"-Wextra"
,
]
+
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
"-DMACE_ENABLE_NEON"
,
])
+
if_android_armv7
([
"-mfpu=neon"
,
...
...
@@ -64,7 +67,10 @@ cc_test(
srcs
=
glob
(
[
"*_test.cc"
],
),
copts
=
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
copts
=
[
"-Werror"
,
"-Wextra"
,
]
+
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
"-DMACE_ENABLE_NEON"
,
])
+
if_android_armv7
([
"-mfpu=neon"
,
...
...
@@ -88,7 +94,10 @@ cc_test(
name
=
"ops_benchmark"
,
testonly
=
1
,
srcs
=
glob
([
"*_benchmark.cc"
]),
copts
=
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
copts
=
[
"-Werror"
,
"-Wextra"
,
]
+
if_openmp_enabled
([
"-fopenmp"
])
+
if_neon_enabled
([
"-DMACE_ENABLE_NEON"
,
])
+
if_android_armv7
([
"-mfpu=neon"
,
...
...
mace/ops/identity.h
浏览文件 @
758fff83
...
...
@@ -32,6 +32,7 @@ class IdentityOp : public Operator<D, T> {
const
Tensor
*
input
=
this
->
Input
(
INPUT
);
Tensor
*
output
=
this
->
Output
(
OUTPUT
);
output
->
ReuseTensorBuffer
(
*
input
);
SetFutureDefaultWaitFn
(
future
);
return
MACE_SUCCESS
;
}
...
...
mace/ops/shape.h
浏览文件 @
758fff83
...
...
@@ -42,6 +42,7 @@ class ShapeOp : public Operator<D, T> {
for
(
index_t
i
=
0
;
i
<
input
->
dim_size
();
++
i
)
{
output_data
[
i
]
=
input
->
dim
(
i
);
}
SetFutureDefaultWaitFn
(
future
);
return
MACE_SUCCESS
;
}
...
...
mace/ops/squeeze.h
浏览文件 @
758fff83
...
...
@@ -31,8 +31,6 @@ class SqueezeOp : public Operator<D, T> {
axis_
(
OperatorBase
::
GetRepeatedArgs
<
int
>
(
"axis"
,
{}))
{}
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
MACE_UNUSED
(
future
);
const
Tensor
*
input
=
this
->
Input
(
INPUT
);
Tensor
*
output
=
this
->
Output
(
OUTPUT
);
...
...
@@ -47,6 +45,7 @@ class SqueezeOp : public Operator<D, T> {
output
->
ReuseTensorBuffer
(
*
input
);
output
->
Reshape
(
output_shape
);
SetFutureDefaultWaitFn
(
future
);
return
MACE_SUCCESS
;
}
...
...
mace/ops/stack.h
浏览文件 @
758fff83
...
...
@@ -33,7 +33,6 @@ class StackOp : public Operator<D, T> {
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
const
std
::
vector
<
const
Tensor
*>
&
inputs
=
this
->
Inputs
();
Tensor
*
output
=
this
->
Output
(
OUTPUT
);
return
functor_
(
inputs
,
output
,
future
);
}
...
...
mace/ops/stack_test.cc
浏览文件 @
758fff83
...
...
@@ -29,7 +29,7 @@ void TestStack(const std::vector<index_t> &input_shape,
const
std
::
vector
<
index_t
>
&
output_shape
,
const
std
::
vector
<
float
>
&
output
)
{
OpsTestNet
net
;
for
(
in
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
net
.
AddInputFromArray
<
CPU
,
float
>
(
MakeString
(
"Input"
,
i
),
input_shape
,
inputs
[
i
]);
}
...
...
@@ -38,7 +38,7 @@ void TestStack(const std::vector<index_t> &input_shape,
.
Output
(
"Output"
)
.
AddIntArg
(
"axis"
,
axis
);
for
(
in
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
op_builder
.
Input
(
MakeString
(
"Input"
,
i
));
}
op_builder
.
Finalize
(
net
.
NewOperatorDef
());
...
...
mace/tools/validation/BUILD
浏览文件 @
758fff83
...
...
@@ -4,7 +4,10 @@ load("//mace:mace.bzl", "if_openmp_enabled", "if_android")
cc_binary
(
name
=
"mace_run_static"
,
srcs
=
[
"mace_run.cc"
],
copts
=
if_android
([
copts
=
[
"-Werror"
,
"-Wextra"
,
]
+
if_android
([
"-DMACE_ENABLE_OPENCL"
,
]),
linkopts
=
if_openmp_enabled
([
"-fopenmp"
]),
...
...
@@ -19,7 +22,10 @@ cc_binary(
cc_binary
(
name
=
"mace_run_shared"
,
srcs
=
[
"mace_run.cc"
],
copts
=
if_android
([
copts
=
[
"-Werror"
,
"-Wextra"
,
]
+
if_android
([
"-DMACE_ENABLE_OPENCL"
,
]),
linkopts
=
[
"-lm"
,
"-pie"
,
"-fPIE"
]
+
if_openmp_enabled
([
"-fopenmp"
]),
...
...
tools/converter.py
浏览文件 @
758fff83
...
...
@@ -1045,7 +1045,7 @@ def run_specific_target(flags, configs, target_abi,
def
run_mace
(
flags
):
configs
=
format_model_config
(
flags
.
config
)
configs
=
format_model_config
(
flags
)
target_socs
=
configs
[
YAMLKeyword
.
target_socs
]
if
not
target_socs
or
ALL_SOC_TAG
in
target_socs
:
...
...
@@ -1159,7 +1159,7 @@ def bm_specific_target(flags, configs, target_abi, target_soc, serial_num):
def
benchmark_model
(
flags
):
configs
=
format_model_config
(
flags
.
config
)
configs
=
format_model_config
(
flags
)
target_socs
=
configs
[
YAMLKeyword
.
target_socs
]
if
not
target_socs
or
ALL_SOC_TAG
in
target_socs
:
...
...
@@ -1211,6 +1211,16 @@ def parse_args():
default
=
""
,
required
=
True
,
help
=
"model yaml configuration file path"
)
all_type_parent_parser
.
add_argument
(
"--build_type"
,
type
=
str
,
default
=
""
,
help
=
"Model build type, can be ['proto', 'code']."
)
all_type_parent_parser
.
add_argument
(
"--target_abis"
,
type
=
str
,
default
=
""
,
help
=
"Target ABIs, comma seperated list."
)
build_run_parent_parser
=
argparse
.
ArgumentParser
(
add_help
=
False
)
build_run_parent_parser
.
add_argument
(
'--address_sanitizer'
,
...
...
@@ -1253,16 +1263,6 @@ def parse_args():
"--enable_openmp"
,
action
=
"store_false"
,
help
=
"Enable openmp for multiple thread."
)
build
.
add_argument
(
"--build_type"
,
type
=
str
,
default
=
""
,
help
=
"Model build type, can be ['proto', 'code']."
)
build
.
add_argument
(
"--target_abis"
,
type
=
str
,
default
=
""
,
help
=
"Target ABIs, comma seperated list."
)
run
=
subparsers
.
add_parser
(
'run'
,
parents
=
[
all_type_parent_parser
,
run_bm_parent_parser
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录