From 82ba7006a9eaeca1f94ca9b421734999eb7952ae Mon Sep 17 00:00:00 2001 From: Zheng Tang Date: Wed, 15 Dec 2021 23:27:41 -0700 Subject: [PATCH] Update test_onnx.py --- main/src/main/python/test_onnx.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/src/main/python/test_onnx.py b/main/src/main/python/test_onnx.py index 5c0231992..dc5d7ae1e 100644 --- a/main/src/main/python/test_onnx.py +++ b/main/src/main/python/test_onnx.py @@ -2,6 +2,7 @@ import json import numpy as np from pytorch.seqScorer import * +import time if __name__ == '__main__': @@ -34,7 +35,7 @@ ort_char = onnxruntime.InferenceSession("char.onnx") scoreCountsByLabel = ScoreCountsByLabel() - + start_time = time.time() for taskId in range(0, taskManager.taskCount): taskName = taskManager.tasks[taskId].taskName sentences = taskManager.tasks[taskId].testSentences @@ -78,5 +79,6 @@ print (f"Micro F1 : {scoreCountsByLabel.f1()}") for label in scoreCountsByLabel.labels(): print (f"\tP/R/F1 for label {label} ({scoreCountsByLabel.map[label].gold}): {scoreCountsByLabel.precision(label)} / {scoreCountsByLabel.recall(label)} / {scoreCountsByLabel.f1(label)}") - + duration = time.time() - start_time + print (duration) \ No newline at end of file