(delegate, test_data_folder)
| 7 | |
| 8 | |
| 9 | def run_mock_model(delegate, test_data_folder): |
| 10 | model_path = os.path.join(test_data_folder, 'mock_model.tflite') |
| 11 | interpreter = tflite.Interpreter(model_path=model_path, |
| 12 | experimental_delegates=[delegate]) |
| 13 | interpreter.allocate_tensors() |
| 14 | |
| 15 | # Get input and output tensors. |
| 16 | input_details = interpreter.get_input_details() |
| 17 | output_details = interpreter.get_output_details() |
| 18 | |
| 19 | # Test model on random input data. |
| 20 | input_shape = input_details[0]['shape'] |
| 21 | input_data = np.array(np.random.random_sample(input_shape), dtype=np.uint8) |
| 22 | interpreter.set_tensor(input_details[0]['index'], input_data) |
| 23 | |
| 24 | interpreter.invoke() |
| 25 | |
| 26 | def run_inference(test_data_folder, model_filename, inputs, delegates=None): |
| 27 | model_path = os.path.join(test_data_folder, model_filename) |
no outgoing calls