Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Flip for batched inputs #698

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

guillaumebaquiast
Copy link
Contributor

Random Flip seems to fail for batched inputs.

For instance:

>>> (x_train, y_train), (x_test, y_test) = keras_core.datasets.cifar10.load_data()
>>> keras_core.layers.RandomFlip(mode="horizontal")(x_train[1]) # Works
>>> keras_core.layers.RandomFlip(mode="horizontal")(x_train) # Fails
InvalidArgumentError                      Traceback (most recent call last)
...
{{function_node __wrapped__SelectV2_device_/job:localhost/replica:0/task:0/device:CPU:0}} condition [50000], then [50000,32,32,3], and else [50000,32,32,3] must be broadcastable [Op:SelectV2] name:

This is due to some shape broadcasting gone wrong, which this PR should fix. Added unit-test as well.

Copy link
Contributor

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- thanks for the fix!

@fchollet fchollet merged commit 74ed0a3 into keras-team:main Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants