def _create_batches(self, X, batch_size, shuffle_data=True):
"""
Create batches out of a sequence of data.
This function will append zeros to the end of your data to ensure that
all batches are even-sized. These are masked out during training.
"""
if shuffle_data:
X = shuffle(X)
if batch_size > X.shape[0]:
batch_size = X.shape[0]
max_x = int(np.ceil(X.shape[0] / batch_size))
X = np.resize(X, (max_x, batch_size, X.shape[-1]))
return X
评论列表
文章目录