numpy - Visualising np.reshape for TensorFlow -


i have data feed convolution neural network.

  ranking_list in train:     home_exp = []     away_exp = []     exp = []     home_team = ranking_list[:16]     away_team = ranking_list[16:]     count = 0     h in home_team:         row_h = []         row_a = []         in away_team:             count += 1             ex_h, ex_a = values(h,a)             row_h.append(ex_h)             row_a.append(ex_a)         home_exp+=row_h         away_exp+=row_a      exp = np.array(home_exp + away_exp)     reformatted_training.append(np.reshape(exp, [-1, 16,16,2]))  

i have ranking list contains 32 rankings, 16 of relate home team, , 16 away team, hence list split 2 16 element lists.

then every permutation of these rankings used generate 2 values, ex_h , ex_a.

the picture have in mind want feed in equivalent of 16x16 image 2 channels (one ex_h values, , 1 ex_a values).

is call make np.reshape achieving this, find hard visualise this. i'm little confused -1 , why tensorflow requires rank 4 tensor.

i think right "np.reshape achieving this".

-1 means size of first dimension calculated automatically total_number_of_elements/16/16/2.

the 4 dimensions respectively: batch_size, height, weight, channels (number of feature maps). there batch size, because uses mini-batch gradient descent.


Comments