예제 #1
0
    def __init__(self, incoming, data_shape, inv=False, **kwargs):
        '''
        Need to take input shape of the fft,
        since it needs to precompute fft matrix

        if nx != ny, we need to matrices

        '''
        super(FFT2Layer, self).__init__(incoming, **kwargs)
        self.is_3d = len(data_shape) == 5
        self.data_shape = data_shape
        if self.is_3d:
            n, _, nx, ny, nt = data_shape
        else:
            n, _, nx, ny = data_shape
        # create matrix which performs fft

        if inv:
            fourier_mat_x = inverse_fourier_matrix(nx, nx)
            fourier_mat_y = inverse_fourier_matrix(ny, ny) if nx != ny else fourier_mat_x
        else:
            fourier_mat_x = fourier_matrix(nx, nx)
            fourier_mat_y = fourier_matrix(ny, ny) if nx != ny else fourier_mat_x

        self.real_fft_x = np.real(fourier_mat_x).astype(theano.config.floatX)
        self.complex_fft_x = np.imag(fourier_mat_x).astype(theano.config.floatX)
        self.real_fft_y = np.real(fourier_mat_y).astype(theano.config.floatX)
        self.complex_fft_y = np.imag(fourier_mat_y).astype(theano.config.floatX)
예제 #2
0
    def __init__(self, incoming, data_shape, inv=False, **kwargs):
        '''
        Need to take input shape of the fft,
        since it needs to precompute fft matrix

        if nx != ny, we need to matrices

        '''
        super(FFT2Layer, self).__init__(incoming, **kwargs)
        self.is_3d = len(data_shape) == 5
        self.data_shape = data_shape
        if self.is_3d:
            n, _, nx, ny, nt = data_shape
        else:
            n, _, nx, ny = data_shape
        # create matrix which performs fft

        if inv:
            fourier_mat_x = inverse_fourier_matrix(nx, nx)
            fourier_mat_y = inverse_fourier_matrix(ny, ny) if nx != ny else fourier_mat_x
        else:
            fourier_mat_x = fourier_matrix(nx, nx)
            fourier_mat_y = fourier_matrix(ny, ny) if nx != ny else fourier_mat_x

        self.real_fft_x = np.real(fourier_mat_x).astype(theano.config.floatX)
        self.complex_fft_x = np.imag(fourier_mat_x).astype(theano.config.floatX)
        self.real_fft_y = np.real(fourier_mat_y).astype(theano.config.floatX)
        self.complex_fft_y = np.imag(fourier_mat_y).astype(theano.config.floatX)
예제 #3
0
    def __init__(self, incoming, data_shape, inv=False, **kwargs):
        '''
        Need to take input shape of the fft, since it needs to
        precompute fft matrix
        '''
        super(FFTLayer, self).__init__(incoming, **kwargs)
        self.data_shape = data_shape
        n, _, nx, ny = data_shape
        # create matrix which performs fft

        if inv:
            fourier_mat = inverse_fourier_matrix(nx, ny)
        else:
            fourier_mat = fourier_matrix(nx, ny)

        self.real_fft = np.real(fourier_mat)
        self.complex_fft = np.imag(fourier_mat)
예제 #4
0
    def __init__(self, incoming, data_shape, inv=False, **kwargs):
        '''
        Need to take input shape of the fft, since it needs to
        precompute fft matrix
        '''
        super(FFTLayer, self).__init__(incoming, **kwargs)
        self.data_shape = data_shape
        n, _, nx, ny = data_shape
        # create matrix which performs fft

        if inv:
            fourier_mat = inverse_fourier_matrix(nx, ny)
        else:
            fourier_mat = fourier_matrix(nx, ny)

        self.real_fft = np.real(fourier_mat)
        self.complex_fft = np.imag(fourier_mat)