From 13ede1df912c7adc59535036103a2da640613bfe Mon Sep 17 00:00:00 2001 From: Luke Hutton Date: Mon, 9 Jan 2023 10:41:33 +0000 Subject: RFFT2D: Adjust output height to be same as the input The expected output shape of RFFT2d should be (N, H, W/2+1) as opposed to (N, H/2+1, W/2+1). Change-Id: I66d830f1ffa86417b57572b3cd904db0290cac42 --- chapters/tensor_ops.adoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'chapters/tensor_ops.adoc') diff --git a/chapters/tensor_ops.adoc b/chapters/tensor_ops.adoc index b8527bf..cb268fa 100644 --- a/chapters/tensor_ops.adoc +++ b/chapters/tensor_ops.adoc @@ -338,10 +338,12 @@ for_each(0 <= n < N, 0 <= oy < H, 0 <= ox < W, 0 <= c < C ) { Performs a batched 2D real-valued Fast Fourier Transform over the input where the input tensor consists of real values producing complex valued output. The complex output values will be split into the output_real and output_imag tensor arguments. -RFFT2D takes advantage of Hermitian symmetry to only calculate the first half of the output. -Imaginary values with locations h=0,H/2 or w=0,W/2 are zero. +RFFT2D takes advantage of Hermitian symmetry to only calculate the first half of the final output axis. +Imaginary values with locations (0,0), (0,W/2), (H/2,0) and (H/2,W/2) are zero. -image::forward_fft2d.svg["forward FFT definition", align="center"] +// output[h][w] = \sum_{m=0}^{H-1}\sum_{n=0}^{W-1}input[m][n] * \exp\left(-2\pi i\left(\frac{mh}{H} + \frac{nw}{W}\right)\right) + +image::forward_fft2d.svg["forward RFFT definition", align="center"] include::{generated}/operators/RFFT2D.adoc[] @@ -350,7 +352,7 @@ include::{generated}/operators/RFFT2D.adoc[] ERROR_IF(!power_of_two(H)); ERROR_IF(!power_of_two(W)); -for_each(0 <= n < N, 0 <= oy < H/2 + 1, 0 <= ox < W/2 + 1) { +for_each(0 <= n < N, 0 <= oy < H, 0 <= ox < W/2 + 1) { in_out_t sum_real = 0.0; in_out_t sum_imag = 0.0; for_each(0 <= iy < H, 0 <= ix < W) { -- cgit v1.2.1