Ejemplo n.º 1
0
def do_fft(input, n_hidden):
    fft_input = T.reshape(input, (input.shape[0], 2, n_hidden))
    fft_input = fft_input.dimshuffle(0, 2, 1)
    fft_output = cufft(fft_input) / T.sqrt(n_hidden)
    fft_output = fft_output.dimshuffle(0, 2, 1)
    output = T.reshape(fft_output, (input.shape[0], 2 * n_hidden))
    return output
 def do_fft(input, n_hidden):
     fft_input = T.reshape(input, (input.shape[0], 2, n_hidden))
     fft_input = fft_input.dimshuffle(0,2,1)
     fft_output = cufft(fft_input) / T.sqrt(n_hidden)
     fft_output = fft_output.dimshuffle(0,2,1)
     output = T.reshape(fft_output, (input.shape[0], 2*n_hidden))
     return output
Ejemplo n.º 3
0
import theano
from fftconv import cufft, cuifft
import numpy as np
import theano.tensor as T


x = T.tensor3()
trans = cufft(x) / T.sqrt(x.shape[1])
y = T.grad(T.mean(trans), x)

cost = theano.function([x], y)

asd = cost(np.asarray(np.random.rand(10,9,2), dtype='float32'))

import pdb; pdb.set_trace()