diff options
author | Luke Hutton <luke.hutton@arm.com> | 2023-01-10 14:50:31 +0000 |
---|---|---|
committer | Luke Hutton <luke.hutton@arm.com> | 2023-01-24 13:40:17 +0000 |
commit | 261b7b62b959a6c7312d810d9152069fdff69f3e (patch) | |
tree | 2be25cefa14cd21379a9fc6f6c499622b6de8bf8 /verif/frameworks/tosa_verif_framework_compiler_runner.py | |
parent | c253e64710f22016894c0e3ac4e9eb76d62cb2f9 (diff) | |
download | reference_model-261b7b62b959a6c7312d810d9152069fdff69f3e.tar.gz |
Add RFFT2d to the reference model
Includes:
* RFFT2d reference implementation
* TFLite framework tests
* Basic TOSA tests
* Serialization submodule upgrade with support for FFT/RFFT
Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Change-Id: I2a687e9cf87fb62a26160ea52439ba9830bea36e
Diffstat (limited to 'verif/frameworks/tosa_verif_framework_compiler_runner.py')
-rwxr-xr-x | verif/frameworks/tosa_verif_framework_compiler_runner.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/verif/frameworks/tosa_verif_framework_compiler_runner.py b/verif/frameworks/tosa_verif_framework_compiler_runner.py index 3597f2a..c55864a 100755 --- a/verif/frameworks/tosa_verif_framework_compiler_runner.py +++ b/verif/frameworks/tosa_verif_framework_compiler_runner.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2020-2022, ARM Limited. +# Copyright (c) 2020-2023, ARM Limited. # SPDX-License-Identifier: Apache-2.0 import argparse import glob @@ -483,6 +483,20 @@ def run_test(args, test, framework): except KeyError: assert 0, "fail to load tflite result numpy" + # TOSA has no notion of complex datatypes, it represents complex values using two + # fp32 output tensors representing real and imaginary values. When legalizing + # complex operations from frameworks, these two output tensors are combined into + # a single tensor of shape [?, ..., ?, 2] whereby each inner pair of values + # represents the real and imaginary parts of a complex value. This is completed + # by inserting reshape and concatenate TOSA operations during the legalization to + # maintain a one-to-one correspondance with framework outputs, thus simplifying + # legalization. Here tf_result should also match this format before being + # compared to the ref model output. + if tf_result.dtype == np.complex64: + ifm_shape = tf_result.shape + (2,) + tf_result = tf_result.view(np.float32) + tf_result = tf_result.reshape(ifm_shape) + # Generate test descriptor per flatbuffer generation # Input .npy will be shared across different frameworks # Output .npy will be generated in its corresponding flatbuffer |