license import { CropAndResize , CropAndResizeAttrs , CropAndResizeInputs , KernelConfig , KernelFunc , TensorInfo } from '@tensorflow/tfjs-core' ; import { MathBackendWebGL } from '../backend_webgl' ; import { CropAndResizeProgram } from '../crop_and_resize_gpu' ; export const cropAndResize = ( args ) : TensorInfo => { const { inputs , backend , attrs } = args ; const { image , boxes , boxInd } = inputs ; const { cropSize , method , extrapolationValue } = attrs ; const program = new CropAndResizeProgram ( image . shape as [ number , number , number , number ] , boxes . shape as [ number , number ] , cropSize , method , extrapolationValue ) ; return backend . runWebGLProgram ( program , [ image , boxes , boxInd ] , 'float32' ) ; } ; export const cropAndResizeConfig = { kernelName : CropAndResize , backendName : 'webgl' , kernelFunc : cropAndResize as { } as KernelFunc } ;