I'm sure my question exists on the internet, i just don't know the right formulations.
I have a data-sample as input for a NN. This sample has the shape (1, 8, 28, 80). Basically it is 80 timesteps of an image. -> y=8, x=28, time=80
i can extract the image at time=0 with:
np_img = image.data.numpy() # shape (1, 8, 28, 80) t0 = np_img[:, :, :, 0]
in order to be able to plot the images at each timestamp below each other, resulting in an array of (640, 28), ergo concatenating along the y-axis I do:
amount_timeslots = img.shape[-1] new_array = img[:, :, :, 0] for i in range(1, amount_timeslots): ti = img[:, :, :, i] new_array = np.concatenate((new_array, ti)) new_array.shape # (640, 28)
Is there a more pythonic way by using build in numpy magic to do this?