Skip to content

Commit 9d751d6

Browse files
LewuatheNikhil Thorat
authored and
Nikhil Thorat
committed
Call corresponding fft ops in rfft and irfft. (tensorflow#1402)
1 parent 8fb4089 commit 9d751d6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/ops/spectral_ops.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ function rfft_(input: Tensor): Tensor {
115115
const zeros = input.zerosLike();
116116
const complexInput = complex(input, zeros).as2D(batch, innerDimensionSize);
117117

118-
const ret = ENV.engine.runKernel(backend => backend.fft(complexInput),
119-
{complexInput});
118+
const ret = fft(complexInput);
120119

121120
// Exclude complex conjugations. These conjugations are put symmetrically.
122121
const half = Math.floor(innerDimensionSize / 2) + 1;
@@ -156,8 +155,7 @@ function irfft_(input: Tensor): Tensor {
156155

157156
if (innerDimensionSize <= 2) {
158157
const complexInput = input.as2D(batch, innerDimensionSize);
159-
const ret = ENV.engine.runKernel(
160-
backend => backend.ifft(complexInput), {complexInput});
158+
const ret = ifft(complexInput);
161159
return real(ret);
162160
} else {
163161
// The length of unique components of the DFT of a real-valued signal
@@ -176,8 +174,7 @@ function irfft_(input: Tensor): Tensor {
176174
const r = realInput.concat(realConjugate, 1);
177175
const i = imagInput.concat(imagConjugate, 1);
178176
const complexInput = complex(r, i).as2D(outputShape[0], outputShape[1]);
179-
const ret = ENV.engine.runKernel(
180-
backend => backend.ifft(complexInput), {complexInput});
177+
const ret = ifft(complexInput);
181178
return real(ret);
182179
}
183180
}

0 commit comments

Comments
 (0)