I have a 8x8 matrix as follows:
[[ 0.3 0.3 0.3 0.3 0.3 0.5 0.1 -0.1]
[ 0.1 0.1 -0.1 0.3 0.3 -0.1 -0.1 -0.5]
[-0.1 0.1 0.3 -0.1 0.3 -0.1 -0.1 -0.1]
[-0.1 0.1 0.5 0.3 -0.3 -0.1 -0.3 -0.1]
[ 0.5 0.1 -0.1 0.1 -0.1 -0.1 -0.3 -0.5]
[ 0.1 -0.1 -0.3 -0.5 -0.5 -0.1 -0.1 -0.3]
[-0.5 -0.3 -0.3 -0.3 -0.1 -0.5 -0.1 -0.3]
[-0.3 -0.3 -0.3 -0.3 -0.1 -0.1 -0.5 -0.3]]
My window is 2x2. What I am trying to do is get four numbers together (up and down numbers) for pooling. Sample output looks like this:
[[0.3 0.3
0.1 0.1]
[0.3 0.3
-0.1 0.3]
.......
.......
[-0.1 -0.3
-0.5 -0.3]]
What I using is print arr.reshape(16,2,2)
What i can't understand is how to setup axis for this requirement. My output is:
[[[ 0.3 0.3]
[ 0.3 0.3]]
[[ 0.3 0.1]
[ 0.5 -0.1]]
[[ 0.1 -0.1]
[ 0.1 0.3]]
[[ 0.3 -0.1]
[-0.1 -0.5]]
[[-0.1 0.3]
[ 0.1 -0.1]]
[[ 0.3 -0.1]
[-0.1 -0.1]]
[[-0.1 0.5]
[ 0.1 0.3]]
[[-0.3 -0.3]
[-0.1 -0.1]]
[[ 0.5 -0.1]
[ 0.1 0.1]]
[[-0.1 -0.3]
[-0.1 -0.5]]
[[ 0.1 -0.3]
[-0.1 -0.5]]
[[-0.5 -0.1]
[-0.1 -0.3]]
[[-0.5 -0.3]
[-0.3 -0.3]]
[[-0.1 -0.1]
[-0.5 -0.3]]
[[-0.3 -0.3]
[-0.3 -0.3]]
[[-0.1 -0.5]
[-0.1 -0.3]]]
Please explain how would axis be applied on this type of situation. Or if their is a better way to get max-pooling do mention.
Note: All of this is for max-pooling. I am using NumPy, SciPy on python.