Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
项目经理老王
Mace
提交
285a94e3
Mace
项目概览
项目经理老王
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
285a94e3
编写于
2月 01, 2019
作者:
叶
叶剑武
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into 'master'
Fix caffe validate docker bug See merge request !974
上级
5efbfbff
62a8e1cd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
21 deletion
+28
-21
mace/ops/opencl/image/resize_nearest_neighbor.h
mace/ops/opencl/image/resize_nearest_neighbor.h
+0
-2
mace/ops/resize_nearest_neighbor.cc
mace/ops/resize_nearest_neighbor.cc
+1
-1
mace/ops/resize_nearest_neighbor_test.cc
mace/ops/resize_nearest_neighbor_test.cc
+1
-3
tools/common.py
tools/common.py
+14
-9
tools/device.py
tools/device.py
+9
-4
tools/sh_commands.py
tools/sh_commands.py
+3
-2
未找到文件。
mace/ops/opencl/image/resize_nearest_neighbor.h
浏览文件 @
285a94e3
...
...
@@ -94,9 +94,7 @@ MaceStatus ResizeNearestNeighborKernel<T>::Compute(
const
index_t
in_height
=
input
->
dim
(
1
);
const
index_t
in_width
=
input
->
dim
(
2
);
const
index_t
channels
=
input
->
dim
(
3
);
Tensor
::
MappingGuard
input_mapper
(
input
);
Tensor
::
MappingGuard
size_mapper
(
size
);
Tensor
::
MappingGuard
output_mapper
(
output
);
const
index_t
out_height
=
size
->
data
<
int32_t
>
()[
0
];
const
index_t
out_width
=
size
->
data
<
int32_t
>
()[
1
];
const
index_t
channel_blocks
=
RoundUpDiv4
(
channels
);
...
...
mace/ops/resize_nearest_neighbor.cc
浏览文件 @
285a94e3
...
...
@@ -78,6 +78,7 @@ class ResizeNearestNeighborOp<DeviceType::CPU, T> : public Operation {
MACE_UNUSED
(
context
);
const
Tensor
*
input
=
this
->
Input
(
0
);
const
Tensor
*
size
=
this
->
Input
(
1
);
Tensor
::
MappingGuard
size_mapper
(
size
);
Tensor
*
output
=
this
->
Output
(
0
);
MACE_CHECK
(
input
->
dim_size
()
==
4
&&
size
->
dim_size
()
==
1
,
...
...
@@ -95,7 +96,6 @@ class ResizeNearestNeighborOp<DeviceType::CPU, T> : public Operation {
std
::
vector
<
index_t
>
out_shape
{
batch
,
channels
,
out_height
,
out_width
};
MACE_RETURN_IF_ERROR
(
output
->
Resize
(
out_shape
));
Tensor
::
MappingGuard
input_mapper
(
input
);
Tensor
::
MappingGuard
size_mapper
(
size
);
Tensor
::
MappingGuard
output_mapper
(
output
);
const
T
*
input_data
=
input
->
data
<
T
>
();
T
*
output_data
=
output
->
mutable_data
<
T
>
();
...
...
mace/ops/resize_nearest_neighbor_test.cc
浏览文件 @
285a94e3
...
...
@@ -107,9 +107,7 @@ void TestRandomResizeNearestNeighbor() {
{
batch
,
in_height
,
in_width
,
channels
});
net
.
TransformDataFormat
<
DeviceType
::
CPU
,
float
>
(
"Input"
,
NHWC
,
"InputNCHW"
,
NCHW
);
net
.
AddInputFromArray
<
D
,
int32_t
>
(
"Size"
,
{
2
},
size
);
net
.
AddInputFromArray
<
D
,
int32_t
>
(
"Size"
,
{
2
},
size
);
OpDefBuilder
(
"ResizeNearestNeighbor"
,
"ResizeNearestNeighborTest"
)
.
Input
(
"InputNCHW"
)
.
Input
(
"Size"
)
...
...
tools/common.py
浏览文件 @
285a94e3
...
...
@@ -209,28 +209,32 @@ def sha256_checksum(fname):
return
hash_func
.
hexdigest
()
def
get_dockerfile_file
(
dockerfile_path
=
""
,
dockerfile_sha256_checksum
=
""
):
dockerfile
=
dockerfile_path
def
get_dockerfile_info
(
dockerfile_path
=
""
,
dockerfile_sha256_checksum
=
""
,
docker_image_tag
=
""
):
dockerfile_local_path
=
""
if
dockerfile_path
.
startswith
(
"http://"
)
or
\
dockerfile_path
.
startswith
(
"https://"
):
dockerfile
=
\
"third_party/caffe/"
+
md5sum
(
dockerfile_path
)
+
"/Dockerfile"
dockerfile_local_path
=
\
"third_party/caffe/"
+
docker_image_tag
dockerfile
=
dockerfile_local_path
+
"/Dockerfile"
if
not
os
.
path
.
exists
(
dockerfile_local_path
):
os
.
makedirs
(
dockerfile_local_path
)
if
not
os
.
path
.
exists
(
dockerfile
)
or
\
sha256_checksum
(
dockerfile
)
!=
dockerfile_sha256_checksum
:
os
.
makedirs
(
dockerfile
.
strip
(
"/Dockerfile"
))
MaceLogger
.
info
(
"Downloading Dockerfile, please wait ..."
)
six
.
moves
.
urllib
.
request
.
urlretrieve
(
dockerfile_path
,
dockerfile
)
MaceLogger
.
info
(
"Dockerfile downloaded successfully."
)
if
dockerfile
:
if
dockerfile
_local_path
:
if
sha256_checksum
(
dockerfile
)
!=
dockerfile_sha256_checksum
:
MaceLogger
.
error
(
ModuleName
.
MODEL_CONVERTER
,
"Dockerfile sha256checksum not match"
)
else
:
dockerfile
=
"third_party/caffe"
dockerfile_local_path
=
"third_party/caffe"
docker_image_tag
=
"lastest"
return
dockerfile
return
dockerfile
_local_path
,
docker_image_tag
def
get_model_files
(
model_file_path
,
...
...
@@ -397,6 +401,7 @@ class YAMLKeyword(object):
graph_optimize_options
=
'graph_optimize_options'
# internal use for now
cl_mem_type
=
'cl_mem_type'
backend
=
'backend'
docker_image_tag
=
'docker_image_tag'
dockerfile_path
=
'dockerfile_path'
dockerfile_sha256_checksum
=
'dockerfile_sha256_checksum'
...
...
tools/device.py
浏览文件 @
285a94e3
...
...
@@ -626,16 +626,21 @@ class DeviceWrapper:
if
model_config
[
YAMLKeyword
.
quantize
]
==
1
:
validate_type
=
device_type
+
'_QUANTIZE'
dockerfile_path
=
get_dockerfile_file
(
model_config
.
get
(
YAMLKeyword
.
dockerfile_path
),
model_config
.
get
(
YAMLKeyword
.
dockerfile_sha256_checksum
)
# noqa
)
if
YAMLKeyword
.
dockerfile_path
in
model_config
else
"third_party/caffe"
# noqa
dockerfile_path
,
docker_image_tag
=
\
get_dockerfile_info
(
model_config
.
get
(
YAMLKeyword
.
dockerfile_path
),
model_config
.
get
(
YAMLKeyword
.
dockerfile_sha256_checksum
),
model_config
.
get
(
YAMLKeyword
.
docker_image_tag
)
)
if
YAMLKeyword
.
dockerfile_path
in
model_config
\
else
(
"third_party/caffe"
,
"lastest"
)
sh_commands
.
validate_model
(
abi
=
target_abi
,
device
=
self
,
model_file_path
=
model_file_path
,
weight_file_path
=
weight_file_path
,
docker_image_tag
=
docker_image_tag
,
dockerfile_path
=
dockerfile_path
,
platform
=
model_config
[
YAMLKeyword
.
platform
],
device_type
=
device_type
,
...
...
tools/sh_commands.py
浏览文件 @
285a94e3
...
...
@@ -641,6 +641,7 @@ def validate_model(abi,
device
,
model_file_path
,
weight_file_path
,
docker_image_tag
,
dockerfile_path
,
platform
,
device_type
,
...
...
@@ -684,8 +685,8 @@ def validate_model(abi,
validation_threshold
,
","
.
join
(
input_data_types
),
backend
,
log_file
)
elif
platform
==
"caffe"
:
image_name
=
"mace-caffe:
latest"
container_name
=
"mace_caffe_validator"
image_name
=
"mace-caffe:
"
+
docker_image_tag
container_name
=
"mace_caffe_
"
+
docker_image_tag
+
"_
validator"
if
caffe_env
==
common
.
CaffeEnvType
.
LOCAL
:
try
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录