license import { KernelConfig , Reverse , ReverseAttrs , ReverseInputs , tensor1d , util } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const reverseConfig = { kernelName : Reverse , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as ReverseInputs ; const backend = args . backend as NodeJSKernelBackend ; const { dims } = args . attrs as { } as ReverseAttrs ; const opAttrs = [ createTensorsTypeOpAttr ( 'Tidx' , 'int32' ) , createTensorsTypeOpAttr ( 'T' , x . dtype ) ] ; const axes = util . parseAxisParam ( dims , x . shape ) ; const axisTensor = tensor1d ( axes , 'int32' ) ; const res = backend . executeSingleOutput ( 'ReverseV2' , opAttrs , [ x , axisTensor ] ) ; axisTensor . dispose ( ) ; return res ; } } ;