MCPcopy
hub / github.com/tensorflow/tfjs / assert

Function assert

tfjs-vis/src/util/utils.ts:23–27  ·  view source on GitHub ↗
(expr: boolean, msg: string|(() => string))

Source from the content-addressed store, hash-verified

21 * Tests a boolean expression and throws a message if false.
22 */
23export function assert(expr: boolean, msg: string|(() => string)) {
24 if (!expr) {
25 throw new Error(typeof msg === 'string' ? msg : msg());
26 }
27}
28
29export function assertShapesMatch(
30 shapeA: number[], shapeB: number[], errorMessagePrefix = ''): void {

Callers 8

heatmapFunction · 0.90
convertToRowMajorFunction · 0.90
assertLabelsMatchShapeFunction · 0.90
linechartFunction · 0.90
scatterplotFunction · 0.90
confusionMatrixFunction · 0.90
perClassAccuracyFunction · 0.90
assertShapesMatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…