(
vals: DataTypeMap[D], dtype: D, kernelName: string)
| 92 | } |
| 93 | |
| 94 | export function checkComputationForErrors<D extends DataType>( |
| 95 | vals: DataTypeMap[D], dtype: D, kernelName: string): boolean { |
| 96 | if (dtype !== 'float32') { |
| 97 | // Only floating point computations will generate NaN values |
| 98 | return false; |
| 99 | } |
| 100 | for (let i = 0; i < vals.length; i++) { |
| 101 | const num = vals[i] as number; |
| 102 | if (isNaN(num) || !isFinite(num)) { |
| 103 | // Throwing custom exception so behavior is testable. |
| 104 | console.warn(`Found ${num} in the result of '${kernelName}'`); |
| 105 | return true; |
| 106 | } |
| 107 | } |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | export class Logger { |
| 112 | logKernelProfile( |
no outgoing calls
no test coverage detected
searching dependent graphs…