#python-3.x
Вопрос:
def sample_minibatches(входные данные,целевые объекты, размер фрагментов, перемешивание=True): # Предоставляйте фрагменты один за другим
assert inputs.shape[0] == targets.shape[0] if shuffle: indices = np.arange(inputs.shape[0]) np.random.shuffle(indices) for start_idx in range(0, inputs.shape[0] - chunksize 1, chunksize): if shuffle: excerpt = indices[start_idx:start_idx chunksize] else: excerpt = slice(start_idx, start_idx chunksize) yield inputs[excerpt], targets[excerpt]