code: def test_odd(self):
      M = N - 1
  
      inputs_val = np.random.random((1, M, M)).astype("float32")
      inputs = theano.shared(inputs_val)
  
      rfft = theano.gpuarray.fft.curfft(inputs)
      f_rfft = theano.function([], rfft, mode=mode_with_gpu)
      res_rfft = f_rfft()
  
      res_rfft_comp = np.asarray(
          res_rfft[:, :, :, 0]
      ) + 1j * np.asarray(res_rfft[:, :, :, 1])
  
      rfft_ref = np.fft.rfftn(inputs_val, s=(M, M), axes=(1, 2))
  
      utt.assert_allclose(rfft_ref, res_rfft_comp, atol=1e-4, rtol=1e-4)
  
      m = rfft.type()
      ifft = theano.gpuarray.fft.cuirfft(m, is_odd=True)
      f_ifft = theano.function([m], ifft, mode=mode_with_gpu)
      res_ifft = f_ifft(res_rfft)
  
      utt.assert_allclose(inputs_val, np.asarray(res_ifft))
  
      inputs_val = np.random.random((1, M, M // 2 + 1, 2)).astype(
          "float32"
      )
      inputs = theano.shared(inputs_val)
  
      irfft = theano.gpuarray.fft.cuirfft(
          inputs, norm="ortho", is_odd=True
      )
      f_irfft = theano.function([], irfft, mode=mode_with_gpu)
      res_irfft = f_irfft()
  
      inputs_ref = inputs_val[:, :, :, 0] + 1j * inputs_val[:, :, :, 1]
      irfft_ref = np.fft.irfftn(inputs_ref, s=(M, M), axes=(1, 2)) * M
  
      utt.assert_allclose(irfft_ref, res_irfft, atol=1e-4, rtol=1e-4)
  
      # 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, M, M)).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, is_odd=True)
  
      inputs_val = np.random.random((1, M, M // 2 + 1, 2)).astype(
          "float32"
      )
      utt.verify_grad(
          f_irfft, [inputs_val], eps=eps, mode=mode_with_gpu
      )
  
      def f_rfft(inp):
          return theano.gpuarray.fft.curfft(inp, norm="ortho")
  
      inputs_val = np.random.random((1, M, M)).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, norm="no_norm", is_odd=True
          )
  
      inputs_val = np.random.random((1, M, M // 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 7 for calling the TestFFT obj's underlying member method code with example usage: obj.test_odd() and returns: theano, theano, theano, theano