MCPcopy Index your code
hub / github.com/tensorflow/tfjs / checkComputationForErrors

Function checkComputationForErrors

tfjs-core/src/profiler.ts:94–109  ·  view source on GitHub ↗
(
    vals: DataTypeMap[D], dtype: D, kernelName: string)

Source from the content-addressed store, hash-verified

92}
93
94export 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
111export class Logger {
112 logKernelProfile(

Callers 2

profiler_test.tsFile · 0.90
profileKernelMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…