Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
6392835f
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看板
提交
6392835f
编写于
8月 17, 2018
作者:
Y
yejianwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code, fix fill input type, update op list docs
上级
e2e0a7f3
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
38 addition
and
41 deletion
+38
-41
docs/user_guide/op_lists.rst
docs/user_guide/op_lists.rst
+3
-3
mace/core/runtime/opencl/opencl_allocator.cc
mace/core/runtime/opencl/opencl_allocator.cc
+2
-2
mace/core/types.cc
mace/core/types.cc
+1
-1
mace/kernels/fill.h
mace/kernels/fill.h
+10
-12
mace/kernels/opencl/helper.h
mace/kernels/opencl/helper.h
+1
-1
mace/ops/concat_test.cc
mace/ops/concat_test.cc
+4
-4
mace/ops/fill.h
mace/ops/fill.h
+4
-3
mace/ops/fill_test.cc
mace/ops/fill_test.cc
+5
-3
mace/ops/identity_test.cc
mace/ops/identity_test.cc
+1
-1
mace/ops/reshape.h
mace/ops/reshape.h
+3
-3
mace/ops/reshape_test.cc
mace/ops/reshape_test.cc
+1
-1
mace/ops/squeeze_test.cc
mace/ops/squeeze_test.cc
+1
-1
mace/python/tools/converter_tool/tensorflow_converter.py
mace/python/tools/converter_tool/tensorflow_converter.py
+0
-4
mace/test/mace_api_mt_test.cc
mace/test/mace_api_mt_test.cc
+1
-1
mace/test/mace_api_test.cc
mace/test/mace_api_test.cc
+1
-1
未找到文件。
docs/user_guide/op_lists.rst
浏览文件 @
6392835f
...
@@ -12,7 +12,7 @@ Operator lists
...
@@ -12,7 +12,7 @@ Operator lists
"BIAS_ADD","Y",""
"BIAS_ADD","Y",""
"CAST","Y","Only CPU and TensorFlow model is supported."
"CAST","Y","Only CPU and TensorFlow model is supported."
"CHANNEL_SHUFFLE","Y",""
"CHANNEL_SHUFFLE","Y",""
"CONCATENATION","Y","
O
nly support channel axis concatenation."
"CONCATENATION","Y","
For GPU o
nly support channel axis concatenation."
"CONV_2D","Y","Fusion with BN and activation layer is supported."
"CONV_2D","Y","Fusion with BN and activation layer is supported."
"CROP","Y","Only Caffe's crop layer is supported (in GPU, offset on channel-dim should be dividable by 4)."
"CROP","Y","Only Caffe's crop layer is supported (in GPU, offset on channel-dim should be dividable by 4)."
"DECONV_2D","Y","Supports Caffe's Deconvolution and TensorFlow's tf.layers.conv2d_transpose."
"DECONV_2D","Y","Supports Caffe's Deconvolution and TensorFlow's tf.layers.conv2d_transpose."
...
@@ -20,7 +20,7 @@ Operator lists
...
@@ -20,7 +20,7 @@ Operator lists
"DEPTH_TO_SPACE","Y",""
"DEPTH_TO_SPACE","Y",""
"DEQUANTIZE","Y","Model quantization will be supported later."
"DEQUANTIZE","Y","Model quantization will be supported later."
"ELEMENT_WISE","Y","ADD/MUL/DIV/MIN/MAX/NEG/ABS/SQR_DIFF/POW/RSQRT/EQUAL"
"ELEMENT_WISE","Y","ADD/MUL/DIV/MIN/MAX/NEG/ABS/SQR_DIFF/POW/RSQRT/EQUAL"
"EMBEDDING_LOOKUP","Y","
Only support channel axis concatenation.
"
"EMBEDDING_LOOKUP","Y",""
"FULLY_CONNECTED","Y",""
"FULLY_CONNECTED","Y",""
"GROUP_CONV_2D","","Caffe model with group count = channel count is supported."
"GROUP_CONV_2D","","Caffe model with group count = channel count is supported."
"IDENTITY","Y","Only TensorFlow model is supported."
"IDENTITY","Y","Only TensorFlow model is supported."
...
@@ -44,7 +44,7 @@ Operator lists
...
@@ -44,7 +44,7 @@ Operator lists
"SHAPE","Y","Only CPU and TensorFlow is supported."
"SHAPE","Y","Only CPU and TensorFlow is supported."
"STACK","Y","Only CPU and TensorFlow is supported."
"STACK","Y","Only CPU and TensorFlow is supported."
"STRIDEDSLICE","Y","Only CPU and TensorFlow is supported."
"STRIDEDSLICE","Y","Only CPU and TensorFlow is supported."
"S
LICE","Y","In TensorFlow, this op is equivalent to SPLIT; O
nly support channel axis slice."
"S
PLIT","Y","In Caffe, this op is equivalent to SLICE; For GPU o
nly support channel axis slice."
"SOFTMAX","Y",""
"SOFTMAX","Y",""
"SPACE_TO_BATCH_ND", "Y",""
"SPACE_TO_BATCH_ND", "Y",""
"SPACE_TO_DEPTH","Y",""
"SPACE_TO_DEPTH","Y",""
...
...
mace/core/runtime/opencl/opencl_allocator.cc
浏览文件 @
6392835f
...
@@ -70,7 +70,7 @@ MaceStatus OpenCLAllocator::New(size_t nbytes, void **result) const {
...
@@ -70,7 +70,7 @@ MaceStatus OpenCLAllocator::New(size_t nbytes, void **result) const {
MaceStatus
OpenCLAllocator
::
NewImage
(
const
std
::
vector
<
size_t
>
&
image_shape
,
MaceStatus
OpenCLAllocator
::
NewImage
(
const
std
::
vector
<
size_t
>
&
image_shape
,
const
DataType
dt
,
const
DataType
dt
,
void
**
result
)
const
{
void
**
result
)
const
{
MACE_CHECK
(
image_shape
.
size
()
==
2
)
<<
"Image shape's size must equal 2"
;
MACE_CHECK
(
image_shape
.
size
()
==
2
,
"Image shape's size must equal 2"
)
;
VLOG
(
3
)
<<
"Allocate OpenCL image: "
<<
image_shape
[
0
]
<<
", "
VLOG
(
3
)
<<
"Allocate OpenCL image: "
<<
image_shape
[
0
]
<<
", "
<<
image_shape
[
1
];
<<
image_shape
[
1
];
...
@@ -134,7 +134,7 @@ void *OpenCLAllocator::Map(void *buffer, size_t offset, size_t nbytes) const {
...
@@ -134,7 +134,7 @@ void *OpenCLAllocator::Map(void *buffer, size_t offset, size_t nbytes) const {
void
*
OpenCLAllocator
::
MapImage
(
void
*
buffer
,
void
*
OpenCLAllocator
::
MapImage
(
void
*
buffer
,
const
std
::
vector
<
size_t
>
&
image_shape
,
const
std
::
vector
<
size_t
>
&
image_shape
,
std
::
vector
<
size_t
>
*
mapped_image_pitch
)
const
{
std
::
vector
<
size_t
>
*
mapped_image_pitch
)
const
{
MACE_CHECK
(
image_shape
.
size
()
==
2
)
<<
"Just support map 2d image"
;
MACE_CHECK
(
image_shape
.
size
()
==
2
,
"Just support map 2d image"
)
;
auto
cl_image
=
static_cast
<
cl
::
Image2D
*>
(
buffer
);
auto
cl_image
=
static_cast
<
cl
::
Image2D
*>
(
buffer
);
std
::
array
<
size_t
,
3
>
origin
=
{
0
,
0
,
0
};
std
::
array
<
size_t
,
3
>
origin
=
{
0
,
0
,
0
};
std
::
array
<
size_t
,
3
>
region
=
{
image_shape
[
0
],
image_shape
[
1
],
1
};
std
::
array
<
size_t
,
3
>
region
=
{
image_shape
[
0
],
image_shape
[
1
],
1
};
...
...
mace/core/types.cc
浏览文件 @
6392835f
...
@@ -39,7 +39,7 @@ std::string DataTypeToString(const DataType dt) {
...
@@ -39,7 +39,7 @@ std::string DataTypeToString(const DataType dt) {
#endif
#endif
{
DT_UINT8
,
"DT_UINT8"
},
{
DT_UINT8
,
"DT_UINT8"
},
{
DT_INT32
,
"DT_UINT32"
}};
{
DT_INT32
,
"DT_UINT32"
}};
MACE_CHECK
(
dt
!=
DT_INVALID
)
<<
"Not support Invalid data type"
;
MACE_CHECK
(
dt
!=
DT_INVALID
,
"Not support Invalid data type"
)
;
return
dtype_string_map
[
dt
];
return
dtype_string_map
[
dt
];
}
}
...
...
mace/kernels/fill.h
浏览文件 @
6392835f
...
@@ -26,41 +26,39 @@
...
@@ -26,41 +26,39 @@
namespace
mace
{
namespace
mace
{
namespace
kernels
{
namespace
kernels
{
struct
FillBase
{
explicit
FillBase
(
float
value
)
:
value_
(
value
)
{}
int
value_
;
};
template
<
DeviceType
D
,
class
T
>
template
<
DeviceType
D
,
class
T
>
struct
FillFunctor
;
struct
FillFunctor
;
template
<
>
template
<
>
struct
FillFunctor
<
DeviceType
::
CPU
,
float
>
:
FillBase
{
struct
FillFunctor
<
DeviceType
::
CPU
,
float
>
{
explicit
FillFunctor
(
float
value
)
:
FillBase
(
value
)
{}
FillFunctor
(
)
{}
MaceStatus
operator
()(
const
Tensor
*
shape
,
MaceStatus
operator
()(
const
Tensor
*
shape
,
const
Tensor
*
value
,
Tensor
*
output
,
Tensor
*
output
,
StatsFuture
*
future
)
{
StatsFuture
*
future
)
{
MACE_UNUSED
(
future
);
MACE_UNUSED
(
future
);
MACE_CHECK
(
shape
->
dim_size
()
==
1
)
<<
"Shape must be 1-D"
;
MACE_CHECK
(
shape
->
dim_size
()
==
1
,
"Shape must be 1-D"
)
;
const
index_t
num_dims
=
shape
->
dim
(
0
);
const
index_t
num_dims
=
shape
->
dim
(
0
);
Tensor
::
MappingGuard
shape_guard
(
shape
);
Tensor
::
MappingGuard
shape_guard
(
shape
);
const
int32_t
*
shape_data
=
shape
->
data
<
int32_t
>
();
const
int32_t
*
shape_data
=
shape
->
data
<
int32_t
>
();
std
::
vector
<
index_t
>
output_shape
;
std
::
vector
<
index_t
>
output_shape
;
for
(
index_t
i
=
0
;
i
<
num_dims
;
++
i
)
{
for
(
index_t
i
=
0
;
i
<
num_dims
;
++
i
)
{
MACE_CHECK
(
shape_data
[
i
]
>
0
)
<<
"Shape must be non-negative: "
MACE_CHECK
(
shape_data
[
i
]
>
0
,
"Shape must be non-negative: "
,
<<
shape_data
[
i
]
;
shape_data
[
i
])
;
output_shape
.
push_back
(
shape_data
[
i
]);
output_shape
.
push_back
(
shape_data
[
i
]);
}
}
Tensor
::
MappingGuard
value_guard
(
value
);
const
float
*
value_data
=
value
->
data
<
float
>
();
MACE_RETURN_IF_ERROR
(
output
->
Resize
(
output_shape
));
MACE_RETURN_IF_ERROR
(
output
->
Resize
(
output_shape
));
Tensor
::
MappingGuard
output_guard
(
output
);
Tensor
::
MappingGuard
output_guard
(
output
);
float
*
output_data
=
output
->
mutable_data
<
float
>
();
float
*
output_data
=
output
->
mutable_data
<
float
>
();
std
::
fill
(
output_data
,
output_data
+
output
->
size
(),
value_
);
std
::
fill
(
output_data
,
output_data
+
output
->
size
(),
*
value_data
);
return
MACE_SUCCESS
;
return
MACE_SUCCESS
;
}
}
...
...
mace/kernels/opencl/helper.h
浏览文件 @
6392835f
...
@@ -58,7 +58,7 @@ namespace kernels {
...
@@ -58,7 +58,7 @@ namespace kernels {
if (runtime->IsOutOfRangeCheckEnabled()) { \
if (runtime->IsOutOfRangeCheckEnabled()) { \
(kernel_error)->Map(nullptr); \
(kernel_error)->Map(nullptr); \
char *kerror_code = (kernel_error)->mutable_data<char>(); \
char *kerror_code = (kernel_error)->mutable_data<char>(); \
MACE_CHECK(*kerror_code == 0
) << "Kernel error code: " << *kerror_code
;\
MACE_CHECK(*kerror_code == 0
, "Kernel error code: ", *kerror_code)
;\
(kernel_error)->UnMap(); \
(kernel_error)->UnMap(); \
}
}
...
...
mace/ops/concat_test.cc
浏览文件 @
6392835f
...
@@ -55,10 +55,10 @@ TEST_F(ConcatOpTest, CPUSimpleHorizon) {
...
@@ -55,10 +55,10 @@ TEST_F(ConcatOpTest, CPUSimpleHorizon) {
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
for
(
auto
f
:
input0
)
{
for
(
auto
f
:
input0
)
{
ASSER
T_EQ
(
f
,
*
output_ptr
++
);
EXPEC
T_EQ
(
f
,
*
output_ptr
++
);
}
}
for
(
auto
f
:
input1
)
{
for
(
auto
f
:
input1
)
{
ASSER
T_EQ
(
f
,
*
output_ptr
++
);
EXPEC
T_EQ
(
f
,
*
output_ptr
++
);
}
}
}
}
...
@@ -93,10 +93,10 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) {
...
@@ -93,10 +93,10 @@ TEST_F(ConcatOpTest, CPUSimpleVertical) {
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
j
=
0
;
j
<
4
;
++
j
)
{
for
(
int
j
=
0
;
j
<
4
;
++
j
)
{
ASSER
T_EQ
(
input0
[
i
*
4
+
j
],
*
output_ptr
++
);
EXPEC
T_EQ
(
input0
[
i
*
4
+
j
],
*
output_ptr
++
);
}
}
for
(
int
j
=
0
;
j
<
4
;
++
j
)
{
for
(
int
j
=
0
;
j
<
4
;
++
j
)
{
ASSER
T_EQ
(
input1
[
i
*
4
+
j
],
*
output_ptr
++
);
EXPEC
T_EQ
(
input1
[
i
*
4
+
j
],
*
output_ptr
++
);
}
}
}
}
}
}
...
...
mace/ops/fill.h
浏览文件 @
6392835f
...
@@ -28,18 +28,19 @@ class FillOp : public Operator<D, T> {
...
@@ -28,18 +28,19 @@ class FillOp : public Operator<D, T> {
public:
public:
FillOp
(
const
OperatorDef
&
operator_def
,
Workspace
*
ws
)
FillOp
(
const
OperatorDef
&
operator_def
,
Workspace
*
ws
)
:
Operator
<
D
,
T
>
(
operator_def
,
ws
),
:
Operator
<
D
,
T
>
(
operator_def
,
ws
),
functor_
(
OperatorBase
::
GetOptionalArg
<
float
>
(
"value"
,
0.0
f
)
)
{}
functor_
()
{}
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
MaceStatus
Run
(
StatsFuture
*
future
)
override
{
const
Tensor
*
shape
=
this
->
Input
(
SHAPE
);
const
Tensor
*
shape
=
this
->
Input
(
SHAPE
);
const
Tensor
*
value
=
this
->
Input
(
VALUE
);
Tensor
*
output
=
this
->
Output
(
OUTPUT
);
Tensor
*
output
=
this
->
Output
(
OUTPUT
);
return
functor_
(
shape
,
output
,
future
);
return
functor_
(
shape
,
value
,
output
,
future
);
}
}
private:
private:
kernels
::
FillFunctor
<
D
,
T
>
functor_
;
kernels
::
FillFunctor
<
D
,
T
>
functor_
;
MACE_OP_INPUT_TAGS
(
SHAPE
);
MACE_OP_INPUT_TAGS
(
SHAPE
,
VALUE
);
MACE_OP_OUTPUT_TAGS
(
OUTPUT
);
MACE_OP_OUTPUT_TAGS
(
OUTPUT
);
};
};
...
...
mace/ops/fill_test.cc
浏览文件 @
6392835f
...
@@ -28,7 +28,7 @@ void TestFill(const std::vector<int32_t> &shape,
...
@@ -28,7 +28,7 @@ void TestFill(const std::vector<int32_t> &shape,
OpsTestNet
net
;
OpsTestNet
net
;
OpDefBuilder
(
"Fill"
,
"FillTest"
)
OpDefBuilder
(
"Fill"
,
"FillTest"
)
.
Input
(
"Shape"
)
.
Input
(
"Shape"
)
.
AddFloatArg
(
"value"
,
static_cast
<
float
>
(
value
)
)
.
Input
(
"Value"
)
.
Output
(
"Output"
)
.
Output
(
"Output"
)
.
Finalize
(
net
.
NewOperatorDef
());
.
Finalize
(
net
.
NewOperatorDef
());
...
@@ -38,19 +38,21 @@ void TestFill(const std::vector<int32_t> &shape,
...
@@ -38,19 +38,21 @@ void TestFill(const std::vector<int32_t> &shape,
{
static_cast
<
index_t
>
(
shape
.
size
())},
{
static_cast
<
index_t
>
(
shape
.
size
())},
shape
);
shape
);
net
.
AddInputFromArray
<
DeviceType
::
CPU
,
float
>
(
"Value"
,
{},
{
value
});
// Run
// Run
net
.
RunOp
();
net
.
RunOp
();
auto
output
=
net
.
GetTensor
(
"Output"
);
auto
output
=
net
.
GetTensor
(
"Output"
);
for
(
index_t
i
=
0
;
i
<
output
->
dim_size
();
++
i
)
{
for
(
index_t
i
=
0
;
i
<
output
->
dim_size
();
++
i
)
{
ASSER
T_EQ
(
output
->
dim
(
i
),
shape
[
i
]);
EXPEC
T_EQ
(
output
->
dim
(
i
),
shape
[
i
]);
}
}
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
index_t
size
=
output
->
size
();
const
index_t
size
=
output
->
size
();
for
(
index_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
index_t
i
=
0
;
i
<
size
;
++
i
)
{
ASSER
T_EQ
(
output_ptr
[
i
],
value
);
EXPEC
T_EQ
(
output_ptr
[
i
],
value
);
}
}
}
}
}
// namespace
}
// namespace
...
...
mace/ops/identity_test.cc
浏览文件 @
6392835f
...
@@ -46,7 +46,7 @@ void TestIdentity(const std::vector<index_t> &shape) {
...
@@ -46,7 +46,7 @@ void TestIdentity(const std::vector<index_t> &shape) {
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
int
size
=
output
->
size
();
const
int
size
=
output
->
size
();
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
ASSER
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
EXPEC
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
}
}
}
}
}
// namespace
}
// namespace
...
...
mace/ops/reshape.h
浏览文件 @
6392835f
...
@@ -42,12 +42,12 @@ class ReshapeOp : public Operator<D, T> {
...
@@ -42,12 +42,12 @@ class ReshapeOp : public Operator<D, T> {
for
(
int
i
=
0
;
i
<
num_dims
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_dims
;
++
i
)
{
if
(
shape_data
[
i
]
==
-
1
)
{
if
(
shape_data
[
i
]
==
-
1
)
{
MACE_CHECK
(
unknown_idx
==
-
1
)
<<
"Only one input size may be -1"
;
MACE_CHECK
(
unknown_idx
==
-
1
,
"Only one input size may be -1"
)
;
unknown_idx
=
i
;
unknown_idx
=
i
;
out_shape
.
push_back
(
1
);
out_shape
.
push_back
(
1
);
}
else
{
}
else
{
MACE_CHECK
(
shape_data
[
i
]
>=
0
)
<<
"Shape must be non-negative: "
MACE_CHECK
(
shape_data
[
i
]
>=
0
,
"Shape must be non-negative: "
,
<<
shape_data
[
i
]
;
shape_data
[
i
])
;
out_shape
.
push_back
(
shape_data
[
i
]);
out_shape
.
push_back
(
shape_data
[
i
]);
product
*=
shape_data
[
i
];
product
*=
shape_data
[
i
];
}
}
...
...
mace/ops/reshape_test.cc
浏览文件 @
6392835f
...
@@ -53,7 +53,7 @@ void TestReshape(const std::vector<index_t> &org_shape,
...
@@ -53,7 +53,7 @@ void TestReshape(const std::vector<index_t> &org_shape,
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
int
size
=
output
->
size
();
const
int
size
=
output
->
size
();
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
ASSER
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
EXPEC
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
}
}
}
}
}
// namespace
}
// namespace
...
...
mace/ops/squeeze_test.cc
浏览文件 @
6392835f
...
@@ -49,7 +49,7 @@ void TestSqueeze(const std::vector<index_t> &org_shape,
...
@@ -49,7 +49,7 @@ void TestSqueeze(const std::vector<index_t> &org_shape,
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
float
*
output_ptr
=
output
->
data
<
float
>
();
const
int
size
=
output
->
size
();
const
int
size
=
output
->
size
();
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
ASSER
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
EXPEC
T_EQ
(
input_ptr
[
i
],
output_ptr
[
i
]);
}
}
}
}
}
// namespace
}
// namespace
...
...
mace/python/tools/converter_tool/tensorflow_converter.py
浏览文件 @
6392835f
...
@@ -464,10 +464,6 @@ class TensorflowConverter(base_converter.ConverterInterface):
...
@@ -464,10 +464,6 @@ class TensorflowConverter(base_converter.ConverterInterface):
op
=
self
.
convert_general_op
(
tf_op
)
op
=
self
.
convert_general_op
(
tf_op
)
op
.
type
=
MaceOp
.
Fill
.
name
op
.
type
=
MaceOp
.
Fill
.
name
value_arg
=
op
.
arg
.
add
()
value_arg
.
name
=
MaceKeyword
.
mace_value_str
value_arg
.
f
=
tf_op
.
inputs
[
1
].
eval
()
def
convert_fused_batchnorm
(
self
,
tf_op
):
def
convert_fused_batchnorm
(
self
,
tf_op
):
op
=
self
.
convert_general_op
(
tf_op
)
op
=
self
.
convert_general_op
(
tf_op
)
op
.
type
=
MaceOp
.
FoldedBatchNorm
.
name
op
.
type
=
MaceOp
.
FoldedBatchNorm
.
name
...
...
mace/test/mace_api_mt_test.cc
浏览文件 @
6392835f
...
@@ -342,7 +342,7 @@ void MaceRunFunc(const int in_out_size) {
...
@@ -342,7 +342,7 @@ void MaceRunFunc(const int in_out_size) {
MaceEngine
engine
(
device
);
MaceEngine
engine
(
device
);
MaceStatus
status
=
engine
.
Init
(
net_def
.
get
(),
input_names
,
output_names
,
MaceStatus
status
=
engine
.
Init
(
net_def
.
get
(),
input_names
,
output_names
,
reinterpret_cast
<
unsigned
char
*>
(
data
.
data
()));
reinterpret_cast
<
unsigned
char
*>
(
data
.
data
()));
ASSER
T_EQ
(
status
,
MaceStatus
::
MACE_SUCCESS
);
EXPEC
T_EQ
(
status
,
MaceStatus
::
MACE_SUCCESS
);
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
inputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
inputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
outputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
outputs
;
...
...
mace/test/mace_api_test.cc
浏览文件 @
6392835f
...
@@ -336,7 +336,7 @@ void MaceRun(const int in_out_size,
...
@@ -336,7 +336,7 @@ void MaceRun(const int in_out_size,
MaceEngine
engine
(
device
);
MaceEngine
engine
(
device
);
MaceStatus
status
=
engine
.
Init
(
net_def
.
get
(),
input_names
,
output_names
,
MaceStatus
status
=
engine
.
Init
(
net_def
.
get
(),
input_names
,
output_names
,
reinterpret_cast
<
unsigned
char
*>
(
data
.
data
()));
reinterpret_cast
<
unsigned
char
*>
(
data
.
data
()));
ASSER
T_EQ
(
status
,
MaceStatus
::
MACE_SUCCESS
);
EXPEC
T_EQ
(
status
,
MaceStatus
::
MACE_SUCCESS
);
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
inputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
inputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
outputs
;
std
::
map
<
std
::
string
,
mace
::
MaceTensor
>
outputs
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录