From: Андрей Шедько/AI Tools Lab /SRR/Assistant Engineer/삼성전자 Date: Fri, 30 Nov 2018 12:09:04 +0000 (+0300) Subject: [nnc] Fix importer test (#2457) X-Git-Tag: nncc_backup~1228 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37c732c749b23c4c2c9fbe6eac7e8ef8d2dae69c;p=platform%2Fcore%2Fml%2Fnnfw.git [nnc] Fix importer test (#2457) Fixed exit code in importer test, added a version check so that the test is not run on older TF Signed-off-by: Andrei Shedko --- diff --git a/contrib/nnc/unittests/tflite_frontend/test_data/gen_test.py b/contrib/nnc/unittests/tflite_frontend/test_data/gen_test.py index 43a2486..bc9cb6a 100755 --- a/contrib/nnc/unittests/tflite_frontend/test_data/gen_test.py +++ b/contrib/nnc/unittests/tflite_frontend/test_data/gen_test.py @@ -2,10 +2,13 @@ import numpy as np import sys try: + from distutils.version import LooseVersion, StrictVersion import tensorflow as tf + + if (LooseVersion(tf.VERSION) < LooseVersion("1.11.0")): raise (Exception("Wrong Version")) except: - print("!! Tensorflow not installed, tflite frontend test not generated", file=sys.stderr) - exit(999) + print("!! Tensorflow v 1.11 not installed, tflite frontend test not generated", file=sys.stderr) + exit(1) resDir = sys.argv[1] if resDir[-1]!="/": resDir +="/" @@ -22,8 +25,6 @@ out0 = tf.identity(Y, name="out") # Filter the input image. with tf.Session() as sess: out = sess.run(out0, feed_dict = {"input:0": np.ones((1, 28, 28, 1)).astype(np.float32)}) - # print(sess.graph_def) - frozen_graphdef = tf.graph_util.convert_variables_to_constants( sess, sess.graph_def, ["out"]) tflite_model = tf.contrib.lite.TocoConverter(