def fit(self, x, augment=False, rounds=1, seed=None):
    'Computes the internal data stats related to the data-dependent transformations, based on an array of sample data.\n\n        Only required if `featurewise_center` or\n        `featurewise_std_normalization` or `zca_whitening` are set to True.\n\n        # Arguments\n            x: Sample data. Should have rank 4.\n             In case of grayscale data,\n             the channels axis should have value 1, and in case\n             of RGB data, it should have value 3.\n            augment: Boolean (default: False).\n                Whether to fit on randomly augmented samples.\n            rounds: Int (default: 1).\n                If using data augmentation (`augment=True`),\n                this is how many augmentation passes over the data to use.\n            seed: Int (default: None). Random seed.\n       '
    x = np.asarray(x, dtype=K.floatx())
    if (x.ndim != 4):
        raise ValueError(('Input to `.fit()` should have rank 4. Got array with shape: ' + str(x.shape)))
    if (x.shape[self.channel_axis] not in {1, 3, 4}):
        warnings.warn((((((((((('Expected input to be images (as Numpy array) following the data format convention "' + self.data_format) + '" (channels on axis ') + str(self.channel_axis)) + '), i.e. expected either 1, 3 or 4 channels on axis ') + str(self.channel_axis)) + '. However, it was passed an array with shape ') + str(x.shape)) + ' (') + str(x.shape[self.channel_axis])) + ' channels).'))
    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
    if self.featurewise_center:
        self.mean = np.mean(x, axis=(0, self.row_axis, self.col_axis))
        broadcast_shape = [1, 1, 1]
        broadcast_shape[(self.channel_axis - 1)] = x.shape[self.channel_axis]
        self.mean = np.reshape(self.mean, broadcast_shape)
        x -= self.mean
    if self.featurewise_std_normalization:
        self.std = np.std(x, axis=(0, self.row_axis, self.col_axis))
        broadcast_shape = [1, 1, 1]
        broadcast_shape[(self.channel_axis - 1)] = x.shape[self.channel_axis]
        self.std = np.reshape(self.std, broadcast_shape)
        x /= (self.std + K.epsilon())
    if self.zca_whitening:
        flat_x = np.reshape(x, (x.shape[0], ((x.shape[1] * x.shape[2]) * x.shape[3])))
        sigma = (np.dot(flat_x.T, flat_x) / flat_x.shape[0])
        (u, s, _) = linalg.svd(sigma)
        s_inv = (1.0 / np.sqrt((s[np.newaxis] + self.zca_epsilon)))
        self.principal_components = (u * s_inv).dot(u.T)
Computes the internal data stats related to the data-dependent transformations, based on an array of sample data.

Only required if `featurewise_center` or
`featurewise_std_normalization` or `zca_whitening` are set to True.

# Arguments
    x: Sample data. Should have rank 4.
     In case of grayscale data,
     the channels axis should have value 1, and in case
     of RGB data, it should have value 3.
    augment: Boolean (default: False).
        Whether to fit on randomly augmented samples.
    rounds: Int (default: 1).
        If using data augmentation (`augment=True`),
        this is how many augmentation passes over the data to use.
    seed: Int (default: None). Random seed.
def fit(self, x, augment=False, rounds=1, seed=None):
    'Computes the internal data stats related to the data-dependent transformations, based on an array of sample data.\n\n        Only required if `featurewise_center` or\n        `featurewise_std_normalization` or `zca_whitening` are set to True.\n\n        # Arguments\n            x: Sample data. Should have rank 4.\n             In case of grayscale data,\n             the channels axis should have value 1, and in case\n             of RGB data, it should have value 3.\n            augment: Boolean (default: False).\n                Whether to fit on randomly augmented samples.\n            rounds: Int (default: 1).\n                If using data augmentation (`augment=True`),\n                this is how many augmentation passes over the data to use.\n            seed: Int (default: None). Random seed.\n       '
    x = np.asarray(x, dtype=K.floatx())
    if (x.ndim != 4):
        raise ValueError(('Input to `.fit()` should have rank 4. Got array with shape: ' + str(x.shape)))
    if (x.shape[self.channel_axis] not in {1, 3, 4}):
        warnings.warn((((((((((('Expected input to be images (as Numpy array) following the data format convention "' + self.data_format) + '" (channels on axis ') + str(self.channel_axis)) + '), i.e. expected either 1, 3 or 4 channels on axis ') + str(self.channel_axis)) + '. However, it was passed an array with shape ') + str(x.shape)) + ' (') + str(x.shape[self.channel_axis])) + ' channels).'))
    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
    if self.featurewise_center:
        self.mean = np.mean(x, axis=(0, self.row_axis, self.col_axis))
        broadcast_shape = [1, 1, 1]
        broadcast_shape[(self.channel_axis - 1)] = x.shape[self.channel_axis]
        self.mean = np.reshape(self.mean, broadcast_shape)
        x -= self.mean
    if self.featurewise_std_normalization:
        self.std = np.std(x, axis=(0, self.row_axis, self.col_axis))
        broadcast_shape = [1, 1, 1]
        broadcast_shape[(self.channel_axis - 1)] = x.shape[self.channel_axis]
        self.std = np.reshape(self.std, broadcast_shape)
        x /= (self.std + K.epsilon())
    if self.zca_whitening:
        flat_x = np.reshape(x, (x.shape[0], ((x.shape[1] * x.shape[2]) * x.shape[3])))
        sigma = (np.dot(flat_x.T, flat_x) / flat_x.shape[0])
        (u, s, _) = linalg.svd(sigma)
        s_inv = (1.0 / np.sqrt((s[np.newaxis] + self.zca_epsilon)))
        self.principal_components = (u * s_inv).dot(u.T)