import sys, os
import numpy as np
from mnist import load_mnist
(x_train, t_train), (x_test, t_test) = \
load_mnist(normalize=True, one_hot_label=True)
print(x_train.shape)
print(t_train.shape)
train_size=x_train.shape[0]
batch_size = 10
batch_mask = np.random.choice(train_size, batch_size)
x_batch = x_train [ batch_mask ]
t_batch = t_train [batch_mask]
print(batch_mask) #예시[33103 53490 27997 5178 6386 22710 42145 21482 20055 48357]
print(train_size) #60000
1. mnist 불러오기.
mnist.py를 자신이 쓰는 스크립트(코딩할 파일)이 같은 폴더내에 존재해야 import가능 합니다.
2. np.random.choice(train_size, batch_size)
x_train.shape[0]
이 row 첫번째 줄이 아니라
여기서 0 은 컬럼을 뜻하고
x_train.shpae[1]
여기서 1은 row를 뜻합니다.
댓글 없음:
댓글 쓰기