// // This confidential and proprietary software may be used only as // authorised by a licensing agreement from ARM Limited // (C) COPYRIGHT 2020 ARM Limited // ALL RIGHTS RESERVED // The entire notice above must be reproduced on all authorised // copies and copies may only be made to the extent permitted // by a licensing agreement from ARM Limited. === Image Operators ==== RESIZE Resizes a tensor. Resize is only allowed in the H and W dimensions. The NEAREST_NEIGHBOR mode returns the value of the input tensor closest to the calculated sample position for both floating point and integer data formats. Floating point BILINEAR mode returns a bilinearly interpolated output value based on the four closest input sample positions. For integer BILINEAR interpolation mode, the output value is calculated by using the shift value along with the other parameters to create a fixed point scaling factor for each input. These values are then summed to create the value for output, which has 2 * shift fractional bits. To convert back to the original integer size, the output value must be rescaled. For floating point stride, stride_y should be set to IH/OH, stride_x should be set to IW/OW. When using integer stride, stride_y is approximately (IH<0 && stride_y>0); for_each (0<=n> shift; dy = y - (iy<> shift; dx = x - (ix<(input, [N,IH,IW,C], [n,iy0,ix0,c]) v01 = tensor_read(input, [N,IH,IW,C], [n,iy0,ix1,c]) v10 = tensor_read(input, [N,IH,IW,C], [n,iy1,ix0,c]) v11 = tensor_read(input, [N,IH,IW,C], [n,iy1,ix1,c]) out_t acc = v00*(unit-dy)*(unit-dx) + v01*(unit-dy)*dx acc = acc + v10*dy*(unit-dx) + v11*dy*dx; tensor_write(output, [N,OH,OW,C], [n,oy,ox,c], acc) } else if (mode==NEAREST) { iy = (dy >= unit/2) ? iy1 : iy0; ix = (dx >= unit/2) ? ix1 : ix0; v = tensor_read(input, [N,IH,IW,C], [n,iy,ix,c]); tensor_write(output, [N,OH,OW,C], [n,oy,ox,c], v) } } ---- *Supported Data Types:* |=== |Profile|Mode|resize_t|in_t|out_t |Any|signed 8, bilinear|int16|int8|int32 |Any|signed 8, nearest |int16|int8|int8 |Any|signed 16, bilinear|int16|int16|int48 |Any|signed 16, nearest |int16|int16|int16 |MI,MT|float |float|float|float |=== *Resize Modes:* |=== |Mode|Description |NEAREST|Nearest Neighbor |BILINEAR|Bilinear interpoloation |===