You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by co...@apache.org on 2020/11/07 05:07:26 UTC
[incubator-tvm] branch main updated: Fix bug in processing script
(#6867)
This is an automated email from the ASF dual-hosted git repository.
comaniac pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/main by this push:
new b7b69a2 Fix bug in processing script (#6867)
b7b69a2 is described below
commit b7b69a2d1dbfe7a9cd04ddab2e60f33654419d58
Author: Chris Hoge <ch...@hogepodge.com>
AuthorDate: Fri Nov 6 21:07:08 2020 -0800
Fix bug in processing script (#6867)
The argsort command returns a new array that is the sorted
index rather than a new sorted value array. This patch
stores the sorted index in a new variable and uses it to
reference the predicted values.
---
tutorials/get_started/tvmc_command_line_driver.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tutorials/get_started/tvmc_command_line_driver.py b/tutorials/get_started/tvmc_command_line_driver.py
index d844de5..bcdf03e 100644
--- a/tutorials/get_started/tvmc_command_line_driver.py
+++ b/tutorials/get_started/tvmc_command_line_driver.py
@@ -246,10 +246,10 @@ if os.path.exists(output_file):
with np.load(output_file) as data:
scores = softmax(data["output_0"])
scores = np.squeeze(scores)
- scores = np.argsort(scores)[::-1]
+ ranks = np.argsort(scores)[::-1]
- for i in scores[0:5]:
- print("class='%s' with probability=%f" % (labels[i], scores[i]))
+ for rank in ranks[0:5]:
+ print("class='%s' with probability=%f" % (labels[rank], scores[rank]))
########################################################################