From b0c2f19429acb8797062f6c13f403203f34094d5 Mon Sep 17 00:00:00 2001 From: Allan Skellett Date: Wed, 16 Aug 2023 11:51:36 -0400 Subject: [PATCH 1/2] add dummy allocate_tensors() function to match tf.lite.Interpreter API --- python/xmos_ai_tools/xinterpreters/base/base_interpreter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py b/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py index c45fbea7c..2f078fc34 100644 --- a/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py +++ b/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py @@ -103,6 +103,10 @@ def print_memory_plan(self) -> None: """! Abstract method to print a plan of memory allocation""" raise NotImplementedError + def allocate_tensors(self): + """! Dummy function to match tf.lite.Interpreter() API""" + return + def get_input_tensor_size(self, input_index: int = 0, model_index: int = 0) -> int: """! Read the size of the input tensor from the model. @param input_index The index of input tensor to target. From 9dd1a7915f9b979cdc750dddfaca983db698ccc7 Mon Sep 17 00:00:00 2001 From: Allan Skellett Date: Wed, 16 Aug 2023 15:09:17 -0400 Subject: [PATCH 2/2] add error if interpreter fails to load model --- python/xmos_ai_tools/xinterpreters/base/base_interpreter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py b/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py index 2f078fc34..100112cfe 100644 --- a/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py +++ b/python/xmos_ai_tools/xinterpreters/base/base_interpreter.py @@ -402,6 +402,8 @@ def set_model( ) ) self.initialise_interpreter(model_index) + else: + raise ValueError("model_path must be str") def get_model(self, model_index: int = 0): for model in self.models: