license import { KernelConfig , ScatterNd , ScatterNdAttrs , ScatterNdInputs , tensor1d } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const scatterNdConfig = { kernelName : ScatterNd , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { indices , updates } = args . inputs as ScatterNdInputs ; const backend = args . backend as NodeJSKernelBackend ; const { shape } = args . attrs as { } as ScatterNdAttrs ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , updates . dtype ) , createTensorsTypeOpAttr ( 'Tindices' , 'int32' ) ] ; const shapeTensor = tensor1d ( shape , 'int32' ) ; const ret = backend . executeSingleOutput ( ScatterNd , opAttrs , [ indices , updates , shapeTensor ] ) ; shapeTensor . dispose ( ) ; return ret ; } } ;