I would like to slide a ND numpy array. Currently, the code below do the work.
import numpy as np
arr = np.array([np.arange(0,16), np.arange(17,33),np.arange(33,49)])
window_size=4
expected_opt=[arr [:, i:i+window_size]for i in range(0,16,window_size)]
But I curious whether there is more efficient way to achieve similar objective.
one might suggest 1, but the solution gives different output.