Commit 17096081 authored by Yong Tang's avatar Yong Tang Committed by Vijay Vasudevan
Browse files

Improve resize_bicubic performance by reorganizing loops (#13840)



* Improve resize_bicubic performance by reorganizing loops

This fix tries to address the issue raised in 13693 where
performance of `resize_bicubic` is not on par with opencv.

This fix rearranges the loops so that it is the same for
num_channel=40 and num_channel=3:

Pre-fix:
```
CHANNEL=40
opencv: 145.08ms
tf: 314.26ms

CHANNEL=3
opencv: 11.95ms
tf: 8.95ms
```

Post-fix:
```
CHANNEL=40
opencv: 144.25ms
tf: 214.55ms

CHANNEL=3
opencv: 11.78ms
tf: 14.07ms
```

This fix fixes 13693.

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

* Keep special handling of `num_channels=3` for `resize_bicubic`

This commit keeps special handling of `num_channels=3` for
`resize_bicubic`:
Without special handling:
```
opencv: 11.78ms
tf: 14.07ms
```
With special handling:
```
opencv: 11.74ms
tf: 9.46ms
```

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

* Expand Benchmark test for resize_bicubic

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

* Update from review feedback.

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