Here is my aim
In my explanation I am counting row and column from 1.
Given a 2d array of size 784x49 - I want to process it such that in column 1 - row 1,2,3,4,29,30,31,32,57,58,59,60,85,86,7,88 elements are non-zero and rest are zero.
Similiarly for column 2 - row 5,6,7,8,33,34,35,36,61,62,63,64,89,90,91,92 are non-zero and rest are zero.
If you assume 784 to be 28x28 image then you can understand that each of my 49 column is accessing a non-overlapping 4x4 region of the image.
I am thinking of creating a 2d mask of size that 784x49 that has 49x16(=784) elements set to unmasked while others are masked.So that , I can use this mask repeatedly on 784x49 input array to quickly set zeroes in 2d array .
My pseudo code is
first time = 0;
for x in range(0,49) :
initialize a 2D array 'one_column_at_a_time' of 28x28 inputs with all element set to TRUE ;
one_column_at_a_time[x/7:(x/7)+4,(x%7)*4:(x%7)*4+4]=FALSE ;
reshape one_column_at_a_time to 784x1;
if (first time == 0):
first time = 1 ;
full_784x49 = one_column_at_a_time;
else
full_784x49 = vertical_stack(full_784x49,one_column_at_a_time);
I am not able to figure out relevant functions specifically for creating masked 2d numpy array.I know np.vstack , np.reshape , np.zeros , np.ones .
Thanks.