*x.transpose(1, 0, 2)* does the trick.

Thank you Fred & Pascal !

On Thursday, August 11, 2016 at 6:53:34 AM UTC+2, Pascal Lamblin wrote:
>
> Check out x.transpose(...), it should work as in numpy if you want to 
> test. 
>
> On Tue, Aug 02, 2016, Usama Yaseen wrote: 
> > I want to re-order elements in 3d lists/tensor3 such that: (python 
> version) 
> > 
> > x_d = 
> [[[1,0,0,0],[0,11,0,0],[0,0,111,0]],[[2,0,0,0],[0,22,0,0],[0,0,222,0 
> > ]],[[3,0,0,0],[0,33,0,0],[0,0,333,0]]] 
> > 
> > 
> > print(zip(*x_d)) 
> > 
> > 
> > [([1, 0, 0, 0], [2, 0, 0, 0], [3, 0, 0, 0]), ([0, 11, 0, 0], [0, 22, 0, 
> 0], 
> > [0, 33, 0, 0]), ([0, 0, 111, 0], [0, 0, 222, 0], [0, 0, 333, 0])] 
> > 
> > 
> > 
> > How can I achieve the same behavior in Theano ? 
> > 
> > 
> > 
> > import theano 
> > import theano.tensor as T 
> > 
> > 
> > x = T.tensor3('x') 
> > f = theano.function([x], ?) 
> > x_d = 
> [[[1,0,0,0],[0,11,0,0],[0,0,111,0]],[[2,0,0,0],[0,22,0,0],[0,0,222,0 
> > ]],[[3,0,0,0],[0,33,0,0],[0,0,333,0]]] 
> > print(f(x_d)) 
> > 
> > 
> > Thanks ! 
> > 
> > -- 
> > 
> > --- 
> > 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] <javascript:>. 
> > 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