You can do this on two step. First by advanced indexing, her the rows you want in the right order.
Tmp1=x1[y] Tmp2=x2[y] Then join them Tensor.concatenate((tmp1, tmp2), axis=1) Fred Le mar. 31 janv. 2017 04:32, Sébastien LE GALL <[email protected]> a écrit : > Hello, > > Im quite new in theano. > > My problem translated in numpy is : > > I have two matrices of unknown shape: > > x = > > [[ 1., 2., 3., 4.], > [ 5., 6., 7., 8.], > [ 9., 10., 11., 12.], > [ 1., 2., 3., 4.], > [ 5., 6., 7., 8.], > [ 9., 10., 11., 12.], > [ 19., 27., 33., 24.], > [ 54., 66., 74., 38.], > [ 29., 210., 131., 412.], > [ 13., 21., 33., 41.], > [ 55., 66., 74., 83.], > [ 92., 106., 711., 142.]] > > > and y = [0, 10, 82, 10, 82, 0, 2, 2, 9, 2, 0, 10] #vector of id > > > I want to create a list of matrix regrouping rows of same index such as : > > > result = > > [[ 1., 2., 3., 4.], [ 9., 10., 11., 12.],[ 55., 66., > 74., 83.]] #rows from X with index 0 > > [[ 5., 6., 7., 8.], [ 1., 2., 3., 4.], [ 92., 106., > 711., 142.]] #rows from X with index 10 > > [[ 9., 10., 11., 12.], [ 5., 6., 7., 8.]] > #rows from X with index 82 > > [[ 19., 27., 33., 24.],[ 54., 66., 74., 38.]],[ 13., 21., > 33., 41.]] #rows from X with index 2 > > [[ 29., 210., 131., 412.]] > #rows from X with index 9 > > > 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.
