Rate This Document
Findability
Accuracy
Completeness
Readability

Function Description

Operator Function

Performs resampling operations on the input tensor. This operator uses two interpolation algorithms: Nearest Neighbor and Linear.

Formula

  • The nearest neighbor interpolation algorithm is dst(n,c,oh,ow) = src(n,c,ih,iw), where:
    • ih = [(oh + 0.5)/Fh − 0.5]; and
    • iw = [(ow + 0.5)/Fw − 0.5].
  • The mathematical formula for bilinear sampling is 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; and
    • 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.