license import { kernel_impls , KernelConfig , KernelFunc , NonMaxSuppressionV3 , NonMaxSuppressionV3Attrs , NonMaxSuppressionV3Inputs , TensorInfo , TypedArray } from '@tensorflow/tfjs-core' ; const nonMaxSuppressionV3Impl = kernel_impls . nonMaxSuppressionV3Impl ; import { MathBackendCPU } from '../backend_cpu' ; import { assertNotComplex } from '../cpu_util' ; export function nonMaxSuppressionV3 ( args ) { const { inputs , backend , attrs } = args ; const { boxes , scores } = inputs ; const { maxOutputSize , iouThreshold , scoreThreshold } = attrs ; assertNotComplex ( boxes , 'NonMaxSuppression' ) ; const boxesVals = backend . data . get ( boxes . dataId ) . values as TypedArray ; const scoresVals = backend . data . get ( scores . dataId ) . values as TypedArray ; const { selectedIndices } = nonMaxSuppressionV3Impl ( boxesVals , scoresVals , maxOutputSize , iouThreshold , scoreThreshold ) ; return backend . makeTensorInfo ( [ selectedIndices . length ] , 'int32' , new Int32Array ( selectedIndices ) ) ; } export const nonMaxSuppressionV3Config = { kernelName : NonMaxSuppressionV3 , backendName : 'cpu' , kernelFunc : nonMaxSuppressionV3 as { } as KernelFunc } ;