license import { abs , KernelConfig , Prelu , PreluInputs , relu , Tensor , tidy } from '@tensorflow/tfjs' ; export const preluConfig = { kernelName : Prelu , backendName : 'tensorflow' , kernelFunc : ( args ) => { const inputs = args . inputs as PreluInputs ; const x = inputs . x as Tensor ; const alpha = inputs . alpha as Tensor ; return tidy ( ( ) => { const pos = relu ( x ) ; const neg = alpha . mul ( x . sub ( abs ( x ) ) ) . mul ( 0.5 ) ; return pos . add ( neg ) ; } ) ; } } ;