license import { FlipLeftRight , FlipLeftRightInputs , KernelConfig , tensor1d , util } from '@tensorflow/tfjs-core' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const flipLeftRightConfig = { kernelName : FlipLeftRight , backendName : 'tensorflow' , kernelFunc ( { inputs , backend } ) { const nodeBackend = backend as NodeJSKernelBackend ; const { image } = inputs as FlipLeftRightInputs ; const opAttrs = [ createTensorsTypeOpAttr ( 'Tidx' , 'int32' ) , createTensorsTypeOpAttr ( 'T' , image . dtype ) , ] ; const axes = util . parseAxisParam ( [ 2 ] , image . shape ) ; const axisTensor = tensor1d ( axes , 'int32' ) ; const res = nodeBackend . executeSingleOutput ( 'ReverseV2' , opAttrs , [ image , axisTensor ] ) ; axisTensor . dispose ( ) ; return res ; } } ;