Commit 7a97dfc3 authored by Yong Tang's avatar Yong Tang Committed by drpngx
Browse files

Fix tf.image.central_crop return zero dimension (#12239)



* Fix tf.image.central_crop return zero dimension

This fix tries to address the issue raised in 10315
where tf.image.central_crop will return (0, 0, 3)
when input is (240, 320, 3).

The issue is that the calculation was done by dividing
```
fraction_offset = int(1 / ((1 - central_fraction) / 2.0))
```
which causes deviation when accuracy is not enough.

This fix cast the calculation to double until the last step.

This fix fixes 10315.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add test case for tf.image.central_crop return zero dimension

This commit adds test case for 10315.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>
parent 7534e5b0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment