-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissue599.patch
44 lines (42 loc) · 1.54 KB
/
issue599.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff --git a/tools/sh_commands.py b/tools/sh_commands.py
index 4b029485..f34ded69 100644
--- a/tools/sh_commands.py
+++ b/tools/sh_commands.py
@@ -772,15 +772,7 @@ def packaging_lib(libmace_output_dir, project_name):
six.print_("Start packaging '%s' libs into %s" % (project_name,
tar_package_path))
which_sys = platform.system()
- if which_sys == "Linux":
- sh.tar(
- "cvzf",
- "%s" % tar_package_path,
- glob.glob("%s/*" % project_dir),
- "--exclude",
- "%s/_tmp" % project_dir,
- _fg=True)
- elif which_sys == "Darwin":
+ if which_sys == "Linux" or which_sys == "Darwin":
sh.tar(
"--exclude",
"%s/_tmp" % project_dir,
diff --git a/tools/validate.py b/tools/validate.py
index 9980a0a9..b16af3d8 100644
--- a/tools/validate.py
+++ b/tools/validate.py
@@ -64,7 +64,11 @@ def calculate_similarity(u, v, data_type=np.float64):
u = u.astype(data_type)
if v.dtype is not data_type:
v = v.astype(data_type)
- return np.dot(u, v) / (np.linalg.norm(u) * np.linalg.norm(v))
+ norm = (np.linalg.norm(u) * np.linalg.norm(v))
+ if norm == 0:
+ return 1;
+ else:
+ return np.dot(u, v) / norm
def calculate_pixel_accuracy(out_value, mace_out_value):
@@ -454,4 +458,4 @@ if __name__ == '__main__':
FLAGS.input_data_type,
FLAGS.backend,
FLAGS.validation_outputs_data,
- FLAGS.log_file)
+ "")