keras icon indicating copy to clipboard operation
keras copied to clipboard

CenterCrop meets a division-by-zero with jax backend

Open AGFACBNNR opened this issue 1 year ago • 2 comments

As shown in this colab, I have an image of size (11,3). Using CenterCrop I can resize it to (7,17) and (5,4), but I meet a crash when trying to resize it to (5,17). According to the error message, it seems that Keras generates an scaled image of height 0 and passes it to backends. I've tried to change the backend and the same problem also shows up with tensorflow and torch backend. The only difference is that tensorflow and torch checks the existence of 0, while jax directly uses it as a divisor. Currently the output is: 1715918255039

AGFACBNNR avatar May 17 '24 03:05 AGFACBNNR

Hi @AGFACBNNR

Thanks for reporting the issue. I have tested the code snippet and reproduces the reported behaviour. Attached gist file for reference.

We will look into the issue and update you the same.

mehtamansi29 avatar May 21 '24 14:05 mehtamansi29

Just running you colab, I actually see a failure on all backends, jax/tf/torch. So this might just be a general bug.

Either way, open for contributions if someone want to take this on. I'll take a look later too to see if its an easy fix.

Thanks for filing!

mattdangerw avatar May 23 '24 15:05 mattdangerw

Hi, The issue has been fixed and I can see the proper output in the keras-nighlty version, attaching the Gist here for reference

sachinprasadhs avatar Jul 10 '24 22:07 sachinprasadhs

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar Jul 25 '24 01:07 github-actions[bot]

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

github-actions[bot] avatar Aug 08 '24 01:08 github-actions[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Aug 08 '24 01:08 google-ml-butler[bot]