From ea7de7babc319e2fa31c5e1c986e48d6c5370689 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 10 Dec 2020 16:49:39 +0000 Subject: Enable FFT for FP16 Resolves: COMPMID-4051 Change-Id: I0c0bf97212dd281c19d5081e6247e7dc0c23cd6b Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4687 Tested-by: Arm Jenkins Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins --- tests/validation/reference/DFT.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/validation/reference') diff --git a/tests/validation/reference/DFT.cpp b/tests/validation/reference/DFT.cpp index 1f746eaeb7..b98bc77b1d 100644 --- a/tests/validation/reference/DFT.cpp +++ b/tests/validation/reference/DFT.cpp @@ -318,7 +318,7 @@ SimpleTensor ridft_1d(const SimpleTensor &src, bool is_odd) { auto dst = rdft_1d_core(src, FFTDirection::Inverse, is_odd); - const T scaling_factor = dst.shape()[0]; + const T scaling_factor = T(dst.shape()[0]); scale(dst, scaling_factor); return dst; @@ -330,7 +330,7 @@ SimpleTensor dft_1d(const SimpleTensor &src, FFTDirection direction) auto dst = dft_1d_core(src, direction); if(direction == FFTDirection::Inverse) { - const T scaling_factor = dst.shape()[0]; + const T scaling_factor = T(dst.shape()[0]); scale(dst, scaling_factor); } return dst; @@ -359,7 +359,7 @@ SimpleTensor ridft_2d(const SimpleTensor &src, bool is_odd) auto transposed_2 = permute(first_pass, PermutationVector(1U, 0U)); auto dst = rdft_1d_core(transposed_2, direction, is_odd); - const T scaling_factor = dst.shape()[0] * dst.shape()[1]; + const T scaling_factor = T(dst.shape()[0] * dst.shape()[1]); scale(dst, scaling_factor); return dst; } @@ -383,7 +383,7 @@ SimpleTensor dft_2d(const SimpleTensor &src, FFTDirection direction) auto transposed_2 = permute(first_pass, PermutationVector(1U, 0U)); auto dst = dft_1d_core(transposed_2, direction); - const T scaling_factor = dst.shape()[0] * dst.shape()[1]; + const T scaling_factor = T(dst.shape()[0] * dst.shape()[1]); scale(dst, scaling_factor); return dst; @@ -425,6 +425,7 @@ SimpleTensor conv2d_dft(const SimpleTensor &src, const SimpleTensor &w, return slice(conv_res, Coordinates(start_left, start_top), Coordinates(end_right, end_botton)); } +// FP32 template SimpleTensor rdft_1d(const SimpleTensor &src); template SimpleTensor ridft_1d(const SimpleTensor &src, bool is_odd); template SimpleTensor dft_1d(const SimpleTensor &src, FFTDirection direction); @@ -434,6 +435,17 @@ template SimpleTensor ridft_2d(const SimpleTensor &src, bool is_od template SimpleTensor dft_2d(const SimpleTensor &src, FFTDirection direction); template SimpleTensor conv2d_dft(const SimpleTensor &src, const SimpleTensor &w, const PadStrideInfo &conv_info); + +// FP16 +template SimpleTensor rdft_1d(const SimpleTensor &src); +template SimpleTensor ridft_1d(const SimpleTensor &src, bool is_odd); +template SimpleTensor dft_1d(const SimpleTensor &src, FFTDirection direction); + +template SimpleTensor rdft_2d(const SimpleTensor &src); +template SimpleTensor ridft_2d(const SimpleTensor &src, bool is_odd); +template SimpleTensor dft_2d(const SimpleTensor &src, FFTDirection direction); + +template SimpleTensor conv2d_dft(const SimpleTensor &src, const SimpleTensor &w, const PadStrideInfo &conv_info); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1