<p dir="ltr">On Nov 17, 2015 6:53 PM, "Sebastian Berg" <<a href="mailto:sebastian@sipsolutions.net">sebastian@sipsolutions.net</a>> wrote:<br>
><br>
> On Di, 2015-11-17 at 13:49 -0500, Neal Becker wrote:<br>
> > Robert Kern wrote:<br>
> ><br>
> > > On Tue, Nov 17, 2015 at 3:48 PM, Neal Becker <<a href="mailto:ndbecker2@gmail.com">ndbecker2@gmail.com</a>> wrote:<br>
> > >><br>
> > >> I have an array of shape<br>
> > >> (7, 24, 2, 1024)<br>
> > >><br>
> > >> I'd like an array of<br>
> > >> (7, 24, 2048)<br>
> > >><br>
> > >> such that the elements on the last dimension are interleaving the<br>
> > >> elements from the 3rd dimension<br>
> > >><br>
> > >> [0,0,0,0] -> [0,0,0]<br>
> > >> [0,0,1,0] -> [0,0,1]<br>
> > >> [0,0,0,1] -> [0,0,2]<br>
> > >> [0,0,1,1] -> [0,0,3]<br>
> > >> ...<br>
> > >><br>
> > >> What might be the simplest way to do this?<br>
> > ><br>
> > > np.transpose(A, (-2, -1)).reshape(A.shape[:-2] + (-1,))<br>
> ><br>
> > I get an error on that 1st transpose:<br>
> ><br>
><br>
> Transpose needs a slightly different input. If you look at the help, it<br>
> should be clear. The help might also point to np.swapaxes, which may be<br>
> a bit more straight forward for this exact case.</p>
<p dir="ltr">Sorry about that. Was in a rush and working from a faulty memory. <br>
</p>