Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
062fa1e7
Mace
项目概览
慢慢CG
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
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看板
提交
062fa1e7
编写于
12月 05, 2017
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename opmode to netmode.
上级
336bdbed
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
14 addition
and
14 deletion
+14
-14
mace/core/net.cc
mace/core/net.cc
+3
-3
mace/core/net.h
mace/core/net.h
+3
-3
mace/core/operator.cc
mace/core/operator.cc
+3
-3
mace/core/operator.h
mace/core/operator.h
+1
-1
mace/examples/mace_run.cc
mace/examples/mace_run.cc
+1
-1
mace/ops/core_test.cc
mace/ops/core_test.cc
+2
-2
mace/proto/mace.proto
mace/proto/mace.proto
+1
-1
未找到文件。
mace/core/net.cc
浏览文件 @
062fa1e7
...
@@ -18,7 +18,7 @@ NetBase::NetBase(const std::shared_ptr<const NetDef> &net_def,
...
@@ -18,7 +18,7 @@ NetBase::NetBase(const std::shared_ptr<const NetDef> &net_def,
SimpleNet
::
SimpleNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
SimpleNet
::
SimpleNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
Op
Mode
mode
)
const
Net
Mode
mode
)
:
NetBase
(
net_def
,
ws
,
type
),
device_type_
(
type
){
:
NetBase
(
net_def
,
ws
,
type
),
device_type_
(
type
){
VLOG
(
1
)
<<
"Constructing SimpleNet "
<<
net_def
->
name
();
VLOG
(
1
)
<<
"Constructing SimpleNet "
<<
net_def
->
name
();
for
(
int
idx
=
0
;
idx
<
net_def
->
op_size
();
++
idx
)
{
for
(
int
idx
=
0
;
idx
<
net_def
->
op_size
();
++
idx
)
{
...
@@ -93,7 +93,7 @@ bool SimpleNet::Run(RunMetadata *run_metadata) {
...
@@ -93,7 +93,7 @@ bool SimpleNet::Run(RunMetadata *run_metadata) {
unique_ptr
<
NetBase
>
CreateNet
(
const
NetDef
&
net_def
,
unique_ptr
<
NetBase
>
CreateNet
(
const
NetDef
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
Op
Mode
mode
)
{
const
Net
Mode
mode
)
{
std
::
shared_ptr
<
NetDef
>
tmp_net_def
(
new
NetDef
(
net_def
));
std
::
shared_ptr
<
NetDef
>
tmp_net_def
(
new
NetDef
(
net_def
));
return
CreateNet
(
tmp_net_def
,
ws
,
type
,
mode
);
return
CreateNet
(
tmp_net_def
,
ws
,
type
,
mode
);
}
}
...
@@ -101,7 +101,7 @@ unique_ptr<NetBase> CreateNet(const NetDef &net_def,
...
@@ -101,7 +101,7 @@ unique_ptr<NetBase> CreateNet(const NetDef &net_def,
unique_ptr
<
NetBase
>
CreateNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
unique_ptr
<
NetBase
>
CreateNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
Op
Mode
mode
)
{
const
Net
Mode
mode
)
{
unique_ptr
<
NetBase
>
net
(
new
SimpleNet
(
net_def
,
ws
,
type
,
mode
));
unique_ptr
<
NetBase
>
net
(
new
SimpleNet
(
net_def
,
ws
,
type
,
mode
));
return
net
;
return
net
;
}
}
...
...
mace/core/net.h
浏览文件 @
062fa1e7
...
@@ -35,7 +35,7 @@ class SimpleNet : public NetBase {
...
@@ -35,7 +35,7 @@ class SimpleNet : public NetBase {
SimpleNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
SimpleNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
OpMode
mode
=
Op
Mode
::
NORMAL
);
const
NetMode
mode
=
Net
Mode
::
NORMAL
);
bool
Run
(
RunMetadata
*
run_metadata
=
nullptr
)
override
;
bool
Run
(
RunMetadata
*
run_metadata
=
nullptr
)
override
;
...
@@ -49,11 +49,11 @@ class SimpleNet : public NetBase {
...
@@ -49,11 +49,11 @@ class SimpleNet : public NetBase {
unique_ptr
<
NetBase
>
CreateNet
(
const
NetDef
&
net_def
,
unique_ptr
<
NetBase
>
CreateNet
(
const
NetDef
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
OpMode
mode
=
Op
Mode
::
NORMAL
);
const
NetMode
mode
=
Net
Mode
::
NORMAL
);
unique_ptr
<
NetBase
>
CreateNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
unique_ptr
<
NetBase
>
CreateNet
(
const
std
::
shared_ptr
<
const
NetDef
>
&
net_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
OpMode
mode
=
Op
Mode
::
NORMAL
);
const
NetMode
mode
=
Net
Mode
::
NORMAL
);
}
// namespace mace
}
// namespace mace
...
...
mace/core/operator.cc
浏览文件 @
062fa1e7
...
@@ -50,15 +50,15 @@ MACE_REGISTER_DEVICE_TYPE(DeviceType::OPENCL, OPENCLOperatorRegistry);
...
@@ -50,15 +50,15 @@ MACE_REGISTER_DEVICE_TYPE(DeviceType::OPENCL, OPENCLOperatorRegistry);
unique_ptr
<
OperatorBase
>
CreateOperator
(
const
OperatorDef
&
operator_def
,
unique_ptr
<
OperatorBase
>
CreateOperator
(
const
OperatorDef
&
operator_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
Op
Mode
mode
)
{
const
Net
Mode
mode
)
{
OperatorRegistry
*
registry
=
gDeviceTypeRegistry
()
->
at
(
type
);
OperatorRegistry
*
registry
=
gDeviceTypeRegistry
()
->
at
(
type
);
const
int
dtype
=
ArgumentHelper
::
GetSingleArgument
<
OperatorDef
,
int
>
(
operator_def
,
const
int
dtype
=
ArgumentHelper
::
GetSingleArgument
<
OperatorDef
,
int
>
(
operator_def
,
"T"
,
"T"
,
static_cast
<
int
>
(
DT_FLOAT
));
static_cast
<
int
>
(
DT_FLOAT
));
const
int
op_mode_i
=
ArgumentHelper
::
GetSingleArgument
<
OperatorDef
,
int
>
(
operator_def
,
const
int
op_mode_i
=
ArgumentHelper
::
GetSingleArgument
<
OperatorDef
,
int
>
(
operator_def
,
"mode"
,
"mode"
,
static_cast
<
int
>
(
Op
Mode
::
NORMAL
));
static_cast
<
int
>
(
Net
Mode
::
NORMAL
));
const
OpMode
op_mode
=
static_cast
<
Op
Mode
>
(
op_mode_i
);
const
NetMode
op_mode
=
static_cast
<
Net
Mode
>
(
op_mode_i
);
if
(
op_mode
==
mode
)
{
if
(
op_mode
==
mode
)
{
return
registry
->
Create
(
OpKeyBuilder
(
operator_def
.
type
().
data
())
return
registry
->
Create
(
OpKeyBuilder
(
operator_def
.
type
().
data
())
.
TypeConstraint
(
"T"
,
static_cast
<
DataType
>
(
dtype
))
.
TypeConstraint
(
"T"
,
static_cast
<
DataType
>
(
dtype
))
...
...
mace/core/operator.h
浏览文件 @
062fa1e7
...
@@ -196,7 +196,7 @@ MACE_DECLARE_REGISTRY(OPENCLOperatorRegistry,
...
@@ -196,7 +196,7 @@ MACE_DECLARE_REGISTRY(OPENCLOperatorRegistry,
unique_ptr
<
OperatorBase
>
CreateOperator
(
const
OperatorDef
&
operator_def
,
unique_ptr
<
OperatorBase
>
CreateOperator
(
const
OperatorDef
&
operator_def
,
Workspace
*
ws
,
Workspace
*
ws
,
DeviceType
type
,
DeviceType
type
,
const
Op
Mode
mode
);
const
Net
Mode
mode
);
}
// namespace mace
}
// namespace mace
...
...
mace/examples/mace_run.cc
浏览文件 @
062fa1e7
...
@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
...
@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
}
}
// Init model
// Init model
auto
net
=
CreateNet
(
net_def
,
&
ws
,
device_type
,
Op
Mode
::
INIT
);
auto
net
=
CreateNet
(
net_def
,
&
ws
,
device_type
,
Net
Mode
::
INIT
);
net
->
Run
();
net
->
Run
();
// run model
// run model
...
...
mace/ops/core_test.cc
浏览文件 @
062fa1e7
...
@@ -17,7 +17,7 @@ TEST(CoreTest, INIT_MODE) {
...
@@ -17,7 +17,7 @@ TEST(CoreTest, INIT_MODE) {
.
Input
(
"Input"
)
.
Input
(
"Input"
)
.
Output
(
"B2IOutput"
)
.
Output
(
"B2IOutput"
)
.
AddIntArg
(
"buffer_type"
,
kernels
::
BufferType
::
FILTER
)
.
AddIntArg
(
"buffer_type"
,
kernels
::
BufferType
::
FILTER
)
.
AddIntArg
(
"mode"
,
static_cast
<
int
>
(
Op
Mode
::
INIT
))
.
AddIntArg
(
"mode"
,
static_cast
<
int
>
(
Net
Mode
::
INIT
))
.
Finalize
(
&
op_defs
[
op_defs
.
size
()
-
1
]);
.
Finalize
(
&
op_defs
[
op_defs
.
size
()
-
1
]);
Tensor
*
input
=
Tensor
*
input
=
...
@@ -40,7 +40,7 @@ TEST(CoreTest, INIT_MODE) {
...
@@ -40,7 +40,7 @@ TEST(CoreTest, INIT_MODE) {
for
(
auto
&
op_def
:
op_defs
)
{
for
(
auto
&
op_def
:
op_defs
)
{
net_def
.
add_op
()
->
CopyFrom
(
op_def
);
net_def
.
add_op
()
->
CopyFrom
(
op_def
);
}
}
auto
net
=
CreateNet
(
net_def
,
&
ws
,
DeviceType
::
OPENCL
,
Op
Mode
::
INIT
);
auto
net
=
CreateNet
(
net_def
,
&
ws
,
DeviceType
::
OPENCL
,
Net
Mode
::
INIT
);
net
->
Run
();
net
->
Run
();
EXPECT_TRUE
(
ws
.
GetTensor
(
"B2IOutput"
)
!=
nullptr
);
EXPECT_TRUE
(
ws
.
GetTensor
(
"B2IOutput"
)
!=
nullptr
);
...
...
mace/proto/mace.proto
浏览文件 @
062fa1e7
...
@@ -2,7 +2,7 @@ syntax = "proto2";
...
@@ -2,7 +2,7 @@ syntax = "proto2";
package
mace
;
package
mace
;
enum
Op
Mode
{
enum
Net
Mode
{
INIT
=
0
;
INIT
=
0
;
NORMAL
=
1
;
NORMAL
=
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录