Skip to content

Commit

Permalink
Update example and logic for mix_up (keras-team#20643)
Browse files Browse the repository at this point in the history
  • Loading branch information
shashaka authored Dec 13, 2024
1 parent 2d96838 commit a237437
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class RandomHue(BaseImagePreprocessingLayer):
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_hue = keras.layers.RandomHue(factor=0.5, value_range=[0, 1])
augmented_images_batch = random_hue(images[:32])
images = keras.ops.cast(images, "float32")
augmented_images_batch = random_hue(images[:8])
```
"""

Expand Down Expand Up @@ -90,7 +91,7 @@ def get_random_transformation(self, data, training=True, seed=None):

if seed is None:
seed = self._get_seed_generator(self.backend._backend)
invert = self.backend.random.uniform((1,), seed=seed)
invert = self.backend.random.uniform((batch_size,), seed=seed)

invert = self.backend.numpy.where(
invert > 0.5,
Expand Down

0 comments on commit a237437

Please sign in to comment.