load_mnist() の引数で、normalize=False は下のPython コードで 0 ~ 1.0 に正規化しているので、0 ~ 255 の値とした。flatten=False は、(28, 28) の手書き数字画像が必要なので指定している。(x_train, y_train), (x_test, y_test) = load_mnist(normalize=False, flatten=False)
print('x_train shape:', x_train.shape)
print('x_train shape:', y_train.shape)
だったのだが、下の if 文の中の reshape で配列の形を変えている。最後が 1 次元なので、形を変えても問題無いようだ。x_train shape: (60000, 1, 28, 28)
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | - | - | - | - | - | - |