license import { KernelConfig , tensor1d , Unique , UniqueAttrs , UniqueInputs } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const uniqueConfig = { kernelName : Unique , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as UniqueInputs ; const backend = args . backend as NodeJSKernelBackend ; const { axis = 0 } = args . attrs as { } as UniqueAttrs ; const axisTensor = tensor1d ( [ axis ] , 'int32' ) ; try { const opAttrs = [ createTensorsTypeOpAttr ( 'T' , x . dtype ) , createTensorsTypeOpAttr ( 'Taxis' , 'int32' ) , createTensorsTypeOpAttr ( 'out_idx' , 'int32' ) ] ; const inputs = [ x , axisTensor ] ; return backend . executeMultipleOutputs ( 'UniqueV2' , opAttrs , inputs , 2 ) ; } finally { axisTensor . dispose ( ) ; } } } ;