Skip to content

Commit a237437

Browse files
authored
Update example and logic for mix_up (#20643)
1 parent 2d96838 commit a237437

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

keras/src/layers/preprocessing/image_preprocessing/random_hue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class RandomHue(BaseImagePreprocessingLayer):
5555
```python
5656
(images, labels), _ = keras.datasets.cifar10.load_data()
5757
random_hue = keras.layers.RandomHue(factor=0.5, value_range=[0, 1])
58-
augmented_images_batch = random_hue(images[:32])
58+
images = keras.ops.cast(images, "float32")
59+
augmented_images_batch = random_hue(images[:8])
5960
```
6061
"""
6162

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

9192
if seed is None:
9293
seed = self._get_seed_generator(self.backend._backend)
93-
invert = self.backend.random.uniform((1,), seed=seed)
94+
invert = self.backend.random.uniform((batch_size,), seed=seed)
9495

9596
invert = self.backend.numpy.where(
9697
invert > 0.5,

0 commit comments

Comments
 (0)