diff options
author | Jeremy Johnson <jeremy.johnson@arm.com> | 2024-01-30 16:10:50 +0000 |
---|---|---|
committer | Jeremy Johnson <jeremy.johnson@arm.com> | 2024-02-08 11:12:55 +0000 |
commit | 6f57e6e665094959aed40c0e388ac81fbd118720 (patch) | |
tree | 82fdfa4b40baf370aa346e3d19fa3f1760294ee9 /reference_model/test | |
parent | 47ab1762d1c15a7b4c0c068d7294111c5c5f92a2 (diff) | |
download | reference_model-6f57e6e665094959aed40c0e388ac81fbd118720.tar.gz |
Main Compliance: RFFT2D support
Correct ref model to produce imaginery values of zero as specification
indicates at certain output positions.
Fix up precise and abs modes for RFFT2D in ref model to produce correct
results and bounds using abs weights.
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: I33767e4219a260278f7933f28b1799223a95a3cc
Diffstat (limited to 'reference_model/test')
-rw-r--r-- | reference_model/test/generate_tests.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/reference_model/test/generate_tests.cpp b/reference_model/test/generate_tests.cpp index 3be402c..564af4a 100644 --- a/reference_model/test/generate_tests.cpp +++ b/reference_model/test/generate_tests.cpp @@ -1500,4 +1500,60 @@ TEST_CASE("positive - FP32 fft2d dot product (values -8, -7 & -6 from the end)") } } +TEST_CASE("positive - FP32 rfft2d dot product (values -8, -7 & -6 from the end)") +{ + std::string templateJsonCfg = R"({ + "tensors" : { + "real" : { + "generator": "DOT_PRODUCT", + "data_type": "FP32", + "input_type": "VARIABLE", + "shape" : [ 4, 2, 4 ], + "input_pos": 0, + "op" : "FFT2D", + "dot_product_info": { + "s": _SET_, + "ks": 8, + "acc_type": "FP32" + } + } + } + })"; + + const std::string tosaNameReal = "real"; + const size_t tosaElements = 4 * 2 * 4; + + SUBCASE("fft2d, set 0, real") + { + std::vector<uint32_t> expected = { 0xbe14f2f5, 0xbdb6fe4d, 0x3f30b473 }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "0", expected); + } + SUBCASE("fft2d, set 1, real") + { + // NOTE: Python test script produced 0x5e7219eb - so off by 1 + std::vector<uint32_t> expected = { 0x5e490017, 0x5e57dd30, 0x5e992496 }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "1", expected); + } + SUBCASE("fft2d, set 2, real") + { + std::vector<uint32_t> expected = { 0x3f800000, 0xbe7f1cd4, 0xbdfc67ff }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "2", expected); + } + SUBCASE("fft2d, set 3, real") + { + std::vector<uint32_t> expected = { 0x41800000, 0xbf6d219b, 0x3f2bd153 }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "3", expected); + } + SUBCASE("fft2d, set 4, real") + { + std::vector<uint32_t> expected = { 0x0, 0x0, 0x0 }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "4", expected); + } + SUBCASE("fft2d, set 5, real") + { + std::vector<uint32_t> expected = { 0xdd3f6b86, 0xde49ecfd, 0x5e0be03d }; + fft2d_test_FP32(tosaNameReal, tosaElements, templateJsonCfg, "5", expected); + } +} + TEST_SUITE_END(); // generate |