code: def test_1Dfft(self):
      inputs_val = np.random.random((1, N)).astype("float32")
  
      x = T.matrix("x", dtype="float32")
      rfft = theano.gpuarray.fft.curfft(x)
      f_rfft = theano.function([x], rfft, mode=mode_with_gpu)
      res_rfft = f_rfft(inputs_val)
      res_rfft_comp = np.asarray(res_rfft[:, :, 0]) + 1j * np.asarray(
          res_rfft[:, :, 1]
      )
  
      rfft_ref = np.fft.rfft(inputs_val, axis=1)
  
      utt.assert_allclose(rfft_ref, res_rfft_comp)
  
      m = rfft.type()
      irfft = theano.gpuarray.fft.cuirfft(m)
      f_irfft = theano.function([m], irfft, mode=mode_with_gpu)
      res_irfft = f_irfft(res_rfft)
  
      utt.assert_allclose(inputs_val, np.asarray(res_irfft))
  
      # The numerical gradient of the FFT is sensitive, must set large
      # enough epsilon to get good accuracy.
      eps = 1e-1
  
      def f_rfft(inp):
          return theano.gpuarray.fft.curfft(inp)
  
      inputs_val = np.random.random((1, N)).astype("float32")
      utt.verify_grad(f_rfft, [inputs_val], eps=eps, mode=mode_with_gpu)
  
      def f_irfft(inp):
          return theano.gpuarray.fft.cuirfft(inp)
  
      inputs_val = np.random.random((1, N // 2 + 1, 2)).astype(
          "float32"
      )
      utt.verify_grad(
          f_irfft, [inputs_val], eps=eps, mode=mode_with_gpu
      )
  
file_path: Theano/theano/gpuarray/tests/test_fft.py
imports: from __future__ import absolute_import, print_function, division
  import unittest
  import numpy
  import theano
  import theano.tensor
  from theano.tests import unittest_tools
  import theano.gpuarray.fft
  from .config import mode_with_gpu
  from nose.plugins.skip import SkipTest
  from theano.gpuarray.fft import pygpu_available, skcuda_available, pycuda_available
label_desc: Use image node_id 1 for calling the TestFFT obj's underlying member method code with example usage: obj.test_1Dfft() and returns: theano, theano