Hi,

First of all, the support of complex in Theano is partial, in particular
they are not supported when deriving gradients, and computations on them
will not be moved to GPU.

The approach we used for RFFT was indeed to treat arrays of complex like
arrays of reals with an additional dimension of length 2.

That being said, the error message you encounter is because you defined
W_t as a dmatrix(), which is a matrix of 'float64' dtype, and Theano
is strongly-typed. If W_t is meant to hold complex values, then it
should be declared as a cmatrix() (for complex64) or zmatrix() (for
complex128).

On Wed, Aug 31, 2016, Francisco Vargas wrote:
> For the simple snippet
> *def discrete_fourier_transform(signal_tensor):*
> * """*
> * :param signal_tensor: Tensor of form (number of signals, signals length)*
> 
> * :returns: Discrete fourier transform of each signal*
> 
> * Description:*
> * """*
> 
> * x = T.dmatrix()*
> * W_t = T.dmatrix()*
> * f = T.dot(W_t, x)*
> 
> * # dft matrix*
> * W = dft(signal_tensor.shape[1])*
> 
> * # bind fourier transform*
> * disc_ft = theano.function([W_t, x], f)*
> 
> * # compute and return*
> * return disc_ft(W, signal_tensor)*
> 
> 
> 
> TypeError: ('Bad input argument to theano function with name 
> "integral_transforms.py:41"  at index 0(0-based)', 'TensorType(float64, 
> matrix) cannot store a value of dtype complex128 without risking loss of 
> precision. If you do not mind this loss, you can: 1) explicitly cast your 
> data to float64, or 2) set "allow_input_downcast=True" when calling 
> "function".', array([[ 1.00000000 +0.00000000e+00j,  1.00000000 
> +0.00000000e+00j,
> 
> I can handle it by seperating real and complex then adding them up at the 
> end however I would prefer not to do so
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "theano-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.


-- 
Pascal

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to