Eric Kunze | 286f834 | 2022-06-22 11:30:23 -0700 | [diff] [blame] | 1 | #!/bin/bash -x |
Eric Kunze | 4fb70ed | 2022-08-24 14:08:51 -0700 | [diff] [blame] | 2 | |
| 3 | # Copyright (c) 2022 Arm Limited. |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | |
| 6 | # This script runs the given example networks against the TOSA |
| 7 | # reference model as a reference for using the reference model. |
| 8 | |
Eric Kunze | 286f834 | 2022-06-22 11:30:23 -0700 | [diff] [blame] | 9 | set -e |
| 10 | |
| 11 | run_test() |
| 12 | { |
| 13 | TEST=$1; shift |
| 14 | FRAMEWORK=$1; shift |
| 15 | |
| 16 | echo "#### RUNNING EXAMPLE ${FRAMEWORK} ${TEST}" |
| 17 | |
| 18 | # Assumes the reference model is already built in ../build |
| 19 | |
| 20 | ../build/reference_model/tosa_reference_model \ |
Eric Kunze | 4fb70ed | 2022-08-24 14:08:51 -0700 | [diff] [blame] | 21 | --test_desc=../examples/${TEST}/flatbuffer-${FRAMEWORK}/desc.json \ |
Eric Kunze | 286f834 | 2022-06-22 11:30:23 -0700 | [diff] [blame] | 22 | --ofm_file=out.npy |
| 23 | python3 -c "import sys; import numpy as np; a = np.load(sys.argv[1]); b = np.load(sys.argv[2]); sys.exit(int((a != b).all()));" \ |
Eric Kunze | 4fb70ed | 2022-08-24 14:08:51 -0700 | [diff] [blame] | 24 | ../examples/${TEST}/${FRAMEWORK}_result.npy \ |
| 25 | ../examples/${TEST}/flatbuffer-${FRAMEWORK}/out.npy |
Eric Kunze | 286f834 | 2022-06-22 11:30:23 -0700 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | run_test test_add_1x4x4x4_f32 tf |
| 29 | run_test test_add_1x4x4x4_f32 tflite |
| 30 | run_test test_conv2d_1x1_1x32x32x8_f32_st11_padSAME_dilat11 tf |
| 31 | run_test test_conv2d_1x1_1x32x32x8_f32_st11_padSAME_dilat11 tflite |
| 32 | run_test test_conv2d_1x1_1x32x32x8_qi8_st11_padSAME_dilat11 tflite |