diff --git a/test/fft/test_spectral_op.py b/test/fft/test_spectral_op.py index 075d68b68ed47268ed46dbda63371279a2e7d111..1fdf65d9d884fabfe16b09ba22b197cdadd97d95 100644 --- a/test/fft/test_spectral_op.py +++ b/test/fft/test_spectral_op.py @@ -16,14 +16,7 @@ import re import sys import numpy as np -from spectral_op_np import ( - fft_c2c, - fft_c2c_backward, - fft_c2r, - fft_c2r_backward, - fft_r2c, - fft_r2c_backward, -) +from spectral_op_np import fft_c2c, fft_c2r, fft_r2c import paddle from paddle import _C_ops @@ -155,22 +148,13 @@ class TestFFTC2COp(OpTest): } self.outputs = {'Out': out} - self.out_grad = ( - np.random.random(self.x.shape) + 1j * np.random.random(self.x.shape) - ).astype(self.x.dtype) - self.x_grad = fft_c2c_backward( - self.out_grad, self.axes, self.norm, self.forward - ) - def test_check_output(self): self.check_output() def test_check_grad(self): self.check_grad( - "X", + ["X"], "Out", - user_defined_grads=[self.x_grad], - user_defined_grad_outputs=[self.out_grad], ) @@ -248,16 +232,6 @@ class TestFFTC2ROp(OpTest): } self.outputs = {'Out': out} - self.out_grad = np.random.random(out.shape).astype(out.dtype) - self.x_grad = fft_c2r_backward( - self.x, - self.out_grad, - self.axes, - self.norm, - self.forward, - self.last_dim_size, - ) - def test_check_output(self): self.check_output() @@ -265,8 +239,6 @@ class TestFFTC2ROp(OpTest): self.check_grad( ["X"], "Out", - user_defined_grads=[self.x_grad], - user_defined_grad_outputs=[self.out_grad], ) @@ -332,23 +304,11 @@ class TestFFTR2COp(OpTest): } self.outputs = {'Out': out} - self.out_grad = np.random.random(out.shape).astype(out.dtype) - self.x_grad = fft_r2c_backward( - self.x, - self.out_grad, - self.axes, - self.norm, - self.forward, - self.onesided, - ) - def test_check_output(self): self.check_output() def test_check_grad(self): self.check_grad( - "X", + ["X"], "Out", - user_defined_grads=[self.x_grad], - user_defined_grad_outputs=[self.out_grad], )