license import { ENGINE } from '../engine' ; import { RealDiv , RealDivInputs } from '../kernel_names' ; import { Tensor } from '../tensor' ; import { NamedTensorMap } from '../tensor_types' ; import { makeTypesMatch } from '../tensor_util' ; import { convertToTensor } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import { floorDiv } from './floorDiv' ; import { op } from './operation' ; param a param b doc function div_ < T extends Tensor > ( a , b ) { let $a = convertToTensor ( a , 'a' , 'div' ) ; let $b = convertToTensor ( b , 'b' , 'div' ) ; [ $a , $b ] = makeTypesMatch ( $a , $b ) ; if ( $a . dtype === 'int32' && $b . dtype === 'int32' ) { return floorDiv ( $a , $b ) ; } const inputs = { a : $a , b : $b } ; const attrs = { } ; return ENGINE . runKernel ( RealDiv , inputs as { } as NamedTensorMap , attrs ) as T ; } export const div = op ( { div_ } ) ;