Suppose we have a 6x6 matrix (numpy ndarray) like:
[1 1 2 2 3 3
 1 1 2 2 3 3
 4 4 5 5 6 6
 4 4 5 5 6 6
 7 7 8 8 9 9
 7 7 8 8 9 9]
How would I calculate the mean value of each of the 2x2 submatrices containing the same number, and get as an output a 3x3 matrix?
 
     
    

 
    