I think you can do it with advance indexing. I didn't try it, but I think something like this:
x = tensor3() range = T.arange(3) x[range, range] If this one don't work try other variation advanced subtensor. If that fail you could do an alloc of zeros with call to set_subtensor with the different part. This one will work for sure, but wil probably be less optimal. Fred On Tue, Aug 2, 2016 at 11:22 AM, Usama Yaseen <[email protected]> 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]. > For more options, visit https://groups.google.com/d/optout. > -- --- 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.
