I have the following snippet from 
http://stackoverflow.com/questions/31733166/overlapping-iteration-over-theano-tensor:

*import theano*
*import theano.tensor as T*

*# Input variables*
*x = T.vector("x")*
*slice_size = T.iscalar("slice_size")*


*def step(idx, vect, length):*

*    # From the idx of the start of the slice, the vector and the length of*
*    # the slice, obtain the desired slice.*
*    my_slice = vect[idx:idx + length]*

*    # Do something with the slice here. I don't know what you want to do*
*    # to I'll just return the slice itself.*
*    output = my_slice*

*    return output*

*# Make a vector containing the start idx of every slice*
*slice_start_indices = T.arange(x.shape[0] - slice_size + 1)*

*out, updates = theano.scan(fn=step,*
*                        sequences=[slice_start_indices],*
*                        non_sequences=[x, slice_size])*

*fct = theano.function([x, slice_size], out)*


*print fct(range(17), 5)*


And it fails with:

ValueError: ('The following error happened while compiling the node', 
for{gpu,scan_fn}(Elemwise{Composite{((i0 + i1) - i2)}}.0, 
Elemwise{add,no_inplace}.0, Subtensor{int64:int64:int8}.0, 
Elemwise{Composite{((i0 + i1) - i2)}}.0, GpuFromHost.0), '\n', 'numpy.dtype 
has the wrong size, try recompiling')

-- 

--- 
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