From 37c732c749b23c4c2c9fbe6eac7e8ef8d2dae69c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A8=D0=B5=D0=B4?= =?utf8?q?=D1=8C=D0=BA=D0=BE/AI=20Tools=20Lab=20/SRR/Assistant=20Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 30 Nov 2018 15:09:04 +0300 Subject: [PATCH] [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 --- contrib/nnc/unittests/tflite_frontend/test_data/gen_test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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( -- 2.7.4