I have a 3 dimensional numpy array with dimensions (x = 2, y = 2, z = 3), as shown below
a = [[[0,1,2],[3,4,5]],
[[6,7,8],[9,10,11]]]
I want to get first N elements from each (x, y) element of a, where N is defined in another array of size x,y. E.g.
b = [[1,2],
[0,0]]
The result would should be
c = [[[0,1],[3,4,5]],
[[6],[9]]
How can I do this without loops?