Hi numpy beginner here:
I'm trying to create an array of shape NxWxHx2 initialized with the corresponding index values. in this case W=H always.
e.g.: for an array of shape Nx5x5x2, if I would write it on Paper it should be:
N times the following
(0,0) (0,1) (0,2) (0,3) (0,4)
(1,0) (1,1) (1,2) (1,3) (1,4)
(2,0) (2,1) (2,2) (2,3) (2,4)
(3,0) (3,1) (3,2) (3,3) (3,4)
(4,0) (4,1) (4,2) (4,3) (4,4)
I looked into the "arange" fkt as well as extending arrays with "newaxis" but couldn't manage to get the desired result.
sorry for the terrible formating.
thanks for the help!
edit: I came up with something like this but it isn't nice. for an array of shape 1x3x3x2
t = np.empty([1,3,3,2])
for n in range(1):
for i in range(3):
for p in range(3):
for r in range(2):
if r == 0:
t[n,i,p,r]=i
else:
t[n,i,p,r]=p