license import { ENGINE } from '../engine' ; import { Abs , AbsInputs , ComplexAbs , ComplexAbsInputs } from '../kernel_names' ; import { Tensor } from '../tensor' ; import { NamedTensorMap } from '../tensor_types' ; import { convertToTensor } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import { op } from './operation' ; param x doc function abs_ < T extends Tensor > ( x ) { const $x = convertToTensor ( x , 'x' , 'abs' ) ; if ( $x . dtype === 'complex64' ) { const inputs = { x : $x } ; return ENGINE . runKernel ( ComplexAbs , inputs as { } as NamedTensorMap ) ; } else { const inputs = { x : $x } ; return ENGINE . runKernel ( Abs , inputs as { } as NamedTensorMap ) ; } } export const abs = op ( { abs_ } ) ;