-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
N/A Signed-off-by: Luxuhui <[email protected]>
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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) | ||
+ "") |