diff --git a/test/test.py b/test/test.py index fcd3c2c..569d9ea 100644 --- a/test/test.py +++ b/test/test.py @@ -27,6 +27,7 @@ def __exit__(self, *args): MODEL_DIR = os.path.dirname(os.path.abspath(__file__)) + "/testdata" +TENSOR_DIR = MODEL_DIR script = r""" def bar(a, b): return a + b @@ -411,11 +412,14 @@ def test_run_tflite_model(self): tflmodel = load_model(model_path) con = self.get_client() con.modelstore("tfl_model", "tflite", "cpu", tflmodel) - img = np.random.random((1, 1, 28, 28)).astype(np.float32) + + input_path = os.path.join(TENSOR_DIR, "one.raw") + with open(input_path, 'rb') as f: + img = np.frombuffer(f.read(), dtype=np.float32) con.tensorset("img", img) con.modelexecute("tfl_model", ["img"], ["output1", "output2"]) output = con.tensorget("output1") - self.assertTrue(np.allclose(output, [8])) + self.assertEqual(output, [1]) # AI.MODELRUN is deprecated by AI.MODELEXECUTE def test_deprecated_modelrun(self): diff --git a/test/testdata/one.raw b/test/testdata/one.raw new file mode 100644 index 0000000..d123c10 Binary files /dev/null and b/test/testdata/one.raw differ