I have next code:
from sklearn.model_selection import train_test_split
from scipy.misc import imresize
def _chunks(l, n):
\"\"\"Yield successive n-sized
I also met this problem, and I find a method is that you can insert "while True" block in data generator func. But I cannot get source. You can refer to my code following:
while True:
assert len(inputs) == len(targets)
indices = np.arange(len(inputs))
if shuffle:
np.random.shuffle(indices)
if batchsize > len(indices):
sys.stderr.write('BatchSize out of index size')
batchsize = len(indices)
for start_idx in range(0, len(inputs) - batchsize + 1, batchsize):
if shuffle:
excerpt = indices[start_idx:start_idx + batchsize]
else:
excerpt = slice(start_idx, start_idx + batchsize)
yield inputs[excerpt], targets[excerpt]