license import { KernelConfig , LinSpace , LinSpaceAttrs , scalar , tidy } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const linSpaceConfig = { kernelName : LinSpace , backendName : 'tensorflow' , kernelFunc : ( args ) => { const backend = args . backend as NodeJSKernelBackend ; const { start , stop , num } = args . attrs as { } as LinSpaceAttrs ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , 'float32' ) , createTensorsTypeOpAttr ( 'Tidx' , 'int32' ) ] ; return tidy ( ( ) => { const inputs = [ scalar ( start , 'float32' ) , scalar ( stop , 'float32' ) , scalar ( num , 'int32' ) ] ; return backend . executeSingleOutput ( LinSpace , opAttrs , inputs ) ; } ) ; } } ;