<s> from __future__ import absolute_import , print_function , division <EOL> import numpy <EOL> from numpy . testing import dec <EOL> import theano <EOL> from theano import tensor <EOL> from theano . tests import unittest_tools as utt <EOL> from theano . tensor . fourier import Fourier , fft <EOL> class TestFourier ( utt . InferShapeTester ) : <EOL> rng = numpy . random . RandomState ( <NUM_LIT> ) <EOL> def setUp ( self ) : <EOL> super ( TestFourier , self ) . setUp ( ) <EOL> self . op_class = Fourier <EOL> self . op = fft <EOL> def test_perform ( self ) : <EOL> a = tensor . dmatrix ( ) <EOL> f = theano . function ( [ a ] , self . op ( a , n = <NUM_LIT:10> , axis = <NUM_LIT:0> ) ) <EOL> a = numpy . random . rand ( <NUM_LIT:8> , <NUM_LIT:6> ) <EOL> assert numpy . allclose ( f ( a ) , numpy . fft . fft ( a , <NUM_LIT:10> , <NUM_LIT:0> ) ) <EOL> def test_infer_shape ( self ) : <EOL> a = tensor . dvector ( ) <EOL> self . _compile_and_check ( [ a ] , [ self . op ( a , <NUM_LIT:16> , <NUM_LIT:0> ) ] , <EOL> [ numpy . random . rand ( <NUM_LIT:12> ) ] , <EOL> self . op_class ) <EOL> a = tensor . dmatrix ( ) <EOL> for var in [ self . op ( a , <NUM_LIT:16> , <NUM_LIT:1> ) , self . op ( a , None , <NUM_LIT:1> ) , <EOL> self . op ( a , <NUM_LIT:16> , None ) , self . op ( a , None , None ) ] : <EOL> self . _compile_and_check ( [ a ] , [ var ] , <EOL> [ numpy . random . rand ( <NUM_LIT:12> , <NUM_LIT:4> ) ] , <EOL> self . op_class ) <EOL> b = tensor . iscalar ( ) <EOL> for var in [ self . op ( a , <NUM_LIT:16> , b ) , self . op ( a , None , b ) ] : <EOL> self . _compile_and_check ( [ a , b ] , [ var ] , <EOL> [ numpy . random . rand ( <NUM_LIT:12> , <NUM_LIT:4> ) , <NUM_LIT:0> ] , <EOL> self . op_class ) <EOL> @ dec . skipif ( True , "<STR_LIT>" ) <EOL> def test_gradient ( self ) : <EOL> def fft_test1 ( a ) : <EOL> return self . op ( a , None , None ) <EOL> def fft_test2 ( a ) : <EOL> return self . op ( a , None , <NUM_LIT:0> ) <EOL> def fft_test3 ( a ) : <EOL> return self . op ( a , <NUM_LIT:4> , None ) <EOL> def fft_test4 ( a ) : <EOL> return self . op ( a , <NUM_LIT:4> , <NUM_LIT:0> ) <EOL> pts = [ numpy . random . rand ( <NUM_LIT:5> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:3> ) , <EOL> numpy . random . rand ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) , <EOL> numpy . random . rand ( <NUM_LIT:2> , <NUM_LIT:5> ) , <EOL> numpy . random . rand ( <NUM_LIT:5> ) ] <EOL> for fft_test in [ fft_test1 , fft_test2 , fft_test3 , fft_test4 ] : <EOL> for pt in pts : <EOL> theano . gradient . verify_grad ( fft_test , [ pt ] , <EOL> n_tests = <NUM_LIT:1> , rng = TestFourier . rng , <EOL> out_type = '<STR_LIT>' ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> t = TestFourier ( '<STR_LIT>' ) <EOL> t . setUp ( ) <EOL> t . test_perform ( ) <EOL> t . test_infer_shape ( ) <EOL> t . test_gradient ( ) </s>
