license import { Tensor } from '../tensor' ; import { makeTypesMatch } from '../tensor_util' ; import { convertToTensor } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import { div } from './div' ; import { equal } from './equal' ; import { op } from './operation' ; import { where } from './where' ; import { zerosLike } from './zeros_like' ; param a param b doc function divNoNan_ < T extends Tensor > ( a , b ) { let $a = convertToTensor ( a , 'a' , 'div' ) ; let $b = convertToTensor ( b , 'b' , 'div' ) ; [ $a , $b ] = makeTypesMatch ( $a , $b ) ; const divResult = div ( $a , $b ) ; const zeros = zerosLike ( divResult ) ; const bEqualsZero = equal ( $b , zeros ) ; return where ( bEqualsZero , zeros , divResult ) as T ; } export const divNoNan = op ( { divNoNan_ } ) ;