Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
Binary file added test/testdata/one.raw
Binary file not shown.