Function Description
Operator Function
Performs resampling operations on the input tensor. This operator uses two interpolation algorithms: Nearest Neighbor and Linear.
- Formular of Nearest Neighbor:
- Formular of Linear:dst(n,c,oh,ow) = src(n,c,ih0,iw0) × (1 – Wih) × (1 – Wiw) + src(n,c,ih1,iw0) × Wih × (1 – Wiw) + src(n,c,ih0,iw1) × (1 – Wih) × Wiw + src(n,c,ih1,iw1) × Wih × Wiw, where:
- ih0=⌊oh+0.5Fh−0.5⌋
- ih1=⌈oh+0.5Fh−0.5⌉
- iw0=⌊ow+0.5Fw−0.5⌋
- iw1=⌈ow+0.5Fw−0.5⌉
- Wih=oh+0.5Fh−0.5−ih0
- Wiw=ow+0.5Fw−0.5−iw0
Table 1 Formula parameters Parameter
Description
src
Input source tensor.
dst
Target tensor.
n
Dimension 1 to be sampled.
c
Dimension 2 to be sampled.
ih
Input height.
iw
Input width.
oh
Output height.
ow
Output width.
Parent topic: Resampling