license import { env , KernelConfig , KernelFunc , ResizeBilinear , ResizeBilinearAttrs , ResizeBilinearInputs , TensorInfo } from '@tensorflow/tfjs-core' ; import { MathBackendWebGL } from '../backend_webgl' ; import { ResizeBilinearProgram } from '../resize_bilinear_gpu' ; import { ResizeBilinearPackedProgram } from '../resize_bilinear_packed_gpu' ; export function resizeBilinear ( args ) { const { inputs , backend , attrs } = args ; const { images } = inputs ; const { alignCorners , halfPixelCenters , size } = attrs ; const [ newHeight , newWidth ] = size ; const program = env ( ) . getBool ( 'WEBGL_PACK_IMAGE_OPERATIONS' ) ? new ResizeBilinearPackedProgram ( images . shape as [ number , number , number , number ] , newHeight , newWidth , alignCorners , halfPixelCenters ) : new ResizeBilinearProgram ( images . shape as [ number , number , number , number ] , newHeight , newWidth , alignCorners , halfPixelCenters ) ; return backend . runWebGLProgram ( program , [ images ] , 'float32' ) ; } export const resizeBilinearConfig = { kernelName : ResizeBilinear , backendName : 'webgl' , kernelFunc : resizeBilinear as { } as KernelFunc } ;