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

Function bytesPerElement

tfjs-core/src/util_base.ts:492–502  ·  view source on GitHub ↗
(dtype: DataType)

Source from the content-addressed store, hash-verified

490}
491
492export function bytesPerElement(dtype: DataType): number {
493 if (dtype === 'float32' || dtype === 'int32') {
494 return 4;
495 } else if (dtype === 'complex64') {
496 return 8;
497 } else if (dtype === 'bool') {
498 return 1;
499 } else {
500 throw new Error(`Unknown dtype ${dtype}`);
501 }
502}
503
504/**
505 * Returns the approximate number of bytes allocated in the string array - 2

Callers 1

inferShapeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…