license import { ClipByValue , ClipByValueAttrs , KernelConfig } from '@tensorflow/tfjs-core' ; import { unaryKernelFunc } from '../utils/unary_utils' ; export const clipByValue = unaryKernelFunc ( ClipByValue , ( xi , attrs ) => { const clipAttrs = attrs as { } as ClipByValueAttrs ; if ( xi > clipAttrs . clipValueMax ) { return clipAttrs . clipValueMax ; } return xi < clipAttrs . clipValueMin ? clipAttrs . clipValueMin : xi ; } ) ; export const clipByValueConfig = { kernelName : ClipByValue , backendName : 'cpu' , kernelFunc : clipByValue , } ;