license import { Cumsum , CumsumAttrs , CumsumInputs , KernelConfig , scalar } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const cumsumConfig = { kernelName : Cumsum , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as CumsumInputs ; const backend = args . backend as NodeJSKernelBackend ; const { axis , exclusive , reverse } = args . attrs as { } as CumsumAttrs ; const axisTensor = scalar ( axis , 'int32' ) ; const opAttrs = [ { name : 'exclusive' , type : backend . binding . TF_ATTR_BOOL , value : exclusive } , { name : 'reverse' , type : backend . binding . TF_ATTR_BOOL , value : reverse } , createTensorsTypeOpAttr ( 'T' , x . dtype ) , createTensorsTypeOpAttr ( 'Tidx' , 'int32' ) ] ; const res = backend . executeSingleOutput ( Cumsum , opAttrs , [ x , axisTensor ] ) ; axisTensor . dispose ( ) ; return res ; } } ;