logo
Loading...

為什麼要使用reshape - Cupoy

if K.image_data_format() == 'channels_first':     ...

ml100-2-d96,ml100-2

為什麼要使用reshape

2019/09/08 01:05 PM
機器學習新手論壇
蕭琮寶
觀看數:0
回答數:2
收藏數:0
ml100-2-d96
ml100-2

if K.image_data_format() == 'channels_first':   

     x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols)   

     x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols)  

     input_shape = (1, img_rows, img_cols)

else:   

     x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1)  

     x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1)  

     input_shape = (img_rows, img_cols, 1)


請問老師範例這一段為甚麼要reshape我不太懂