Skip to content

Instantly share code, notes, and snippets.

@boaerosuke
Created August 16, 2017 13:32
Show Gist options
  • Save boaerosuke/eb8a12d8d2f0a75ab26d650bba184e8c to your computer and use it in GitHub Desktop.
Save boaerosuke/eb8a12d8d2f0a75ab26d650bba184e8c to your computer and use it in GitHub Desktop.
Tweak the code that it only sets up channels last
#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)
#changed this to be always channels_last!
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment