Python & Numpy - reshape 10x10 array where each cell is 20x20 array into a 10x10x20x20
so apparent if you do tensor = np.full((10,10,20,20),0) then you can set each cell accordingly like
tensor[x,y] = mat[x,y]
and it'll just fill the 20x20 if the size of the array is also 20x20
I have kind a of weird problem where I have a .mat file that comes in a a 10x10 array where each index is a 20x20 array representing a gray image. So I have 10 trials and each trial are a time series with 10 intervals and each interval is tracked as a 20x20 image. In order to run tensor regression on this using tensorly this needs to be formatted as a (trails, time series, x-dim, y-dim) tensor. Is there a clean way to do this? I tried np.reshape on the mat file but that won't work cause the mat file dimensions are 10x10, cause like I said each cell of the array is the 20x20.
So for example let's say the mat file is variable name 'mat_var.' Then mat_var[0,0] will be a 20x20 array and mat_var will be a 10x10 array
Goal is to reshape a 10x10 array where each index is a 20x20 array into a 10x10x20x20 array.