license import { ENGINE } from '../engine' ; import { ClipByValue , ClipByValueAttrs , ClipByValueInputs } from '../kernel_names' ; import { NamedAttrMap } from '../kernel_registry' ; import { Tensor } from '../tensor' ; import { NamedTensorMap } from '../tensor_types' ; import { convertToTensor } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import * as util from '../util' ; import { op } from './operation' ; param x param clipValueMin param clipValueMax doc function clipByValue_ < T extends Tensor > ( x , clipValueMin , clipValueMax ) { const $x = convertToTensor ( x , 'x' , 'clipByValue' ) ; util . assert ( ( clipValueMin <= clipValueMax ) , ( ) => `Error in clip: min (${ clipValueMin }) must be ` + `less than or equal to max (${ clipValueMax }).` ) ; const inputs = { x : $x } ; const attrs = { clipValueMin , clipValueMax } ; return ENGINE . runKernel ( ClipByValue , inputs as { } as NamedTensorMap , attrs as { } as NamedAttrMap ) ; } export const clipByValue = op ( { clipByValue_ } ) ;