def fit(self, x, augment=False, rounds=1, seed=None):
x = np.asarray(x, dtype=K.floatx())
if x.ndim != 2:
raise ValueError('Input to `.fit()` should have rank 2. '
'Got array with shape: ' + str(x.shape))
if seed is not None:
np.random.seed(seed)
x = np.copy(x)
if augment:
ax = np.zeros(tuple([rounds * x.shape[0]] + list(x.shape)[1:]), dtype=K.floatx())
for r in range(rounds):
for i in range(x.shape[0]):
ax[i + r * x.shape[0]] = self.random_transform(x[i])
x = ax
# @Class: Iterator
# @Description:
# Abstract base class for Music data iterators.
# n: Integer, total number of samples in the dataset to loop over.
# batch_size: Integer, size of a batch.
# shuffle: Boolean, whether to shuffle the data between epochs.
# seed: Random seeding for data shuffling.
评论列表
文章目录