license import { KernelConfig , NamedTensorInfoMap , TensorInfo } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; interface SoftmaxInputs extends NamedTensorInfoMap { logits : TensorInfo ; } export const softmaxConfig = { kernelName : 'Softmax' , backendName : 'tensorflow' , kernelFunc : ( { inputs , backend } ) => { const { logits } = inputs as SoftmaxInputs ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , logits . dtype ) ] ; const nodeBackend = backend as NodeJSKernelBackend ; return nodeBackend . executeSingleOutput ( 'Softmax' , opAttrs , [ logits ] ) ; } } ;