From 0306fb6c98178898da6678d1579436da92add171 Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Fri, 12 Apr 2024 14:18:11 +0100 Subject: RFFT2D, refmodel. Correct code when size is one When width or height are one then H/2 or W/2 are not integral. Signed-off-by: Dmitriy Smirnov Change-Id: I1a849bec7cbb1d55fd5f085ebe58be45ea0b508e --- reference_model/src/ops/tensor_ops.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc index afd20e9..edc1793 100644 --- a/reference_model/src/ops/tensor_ops.cc +++ b/reference_model/src/ops/tensor_ops.cc @@ -1892,7 +1892,8 @@ int OpRFFT2d::eval() // Imaginary values with locations (0,0), (0,W/2), (H/2,0) and (H/2,W/2) are zero. // But due to sin(M_PI) not returning 0 because of M_PI being approximate, only // add to the imaginary sum when not processing these locations. - if ((ay % (half_in_height)) + (ax % (half_in_width)) > 0) + if ((in_height > 1 && (ay % (half_in_height)) > 0) || + (in_width > 1 && (ax % (half_in_width)) > 0)) { sum_imag += v_ir * a_sin; } -- cgit v1.2.1