I have a numpy array of shape [5sx,5sy,5sz] and I’d like to create a tensor with shape [sx,sy,sz] where the value of each element is:
new_array[x,y,z] = mean(array[5x:5x+5,5y:5y+5,5z:5z+5])
I could do this in a loop, but is there a faster one-line approach?
(I'd really ideally like to do it where the size of the origin array is not an integer multiple of the new one, but that seems like a much harder question, and I thought this would be a good first step at least.)