license import { backend_util , KernelConfig , KernelFunc , ScatterNd , ScatterNdAttrs , ScatterNdInputs , TensorInfo } from '@tensorflow/tfjs-core' ; import { MathBackendCPU } from '../backend_cpu' ; import { scatterImpl } from './Scatter_impl' ; export function scatterNd ( args ) { const { inputs , backend , attrs } = args ; const { indices , updates } = inputs ; const { shape } = attrs ; const { sliceRank , numUpdates , sliceSize , strides , outputSize } = backend_util . calculateShapes ( updates , indices , shape ) ; const sumDupeIndices = true ; const indicesBuf = backend . bufferSync ( indices ) ; const updatesBuf = backend . bufferSync ( updates ) ; const outBuf = scatterImpl ( indicesBuf , updatesBuf , shape , outputSize , sliceSize , numUpdates , sliceRank , strides , 0 , sumDupeIndices ) ; return backend . makeTensorInfo ( shape , outBuf . dtype , outBuf . values ) ; } export const scatterNdConfig = { kernelName : ScatterNd , backendName : 'cpu' , kernelFunc : scatterNd as { } as KernelFunc } ;