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

Function sizeFromShape

tfjs-core/src/util_base.ts:181–191  ·  view source on GitHub ↗
(shape: number[])

Source from the content-addressed store, hash-verified

179 * @doc {heading: 'Util', namespace: 'util'}
180 */
181export function sizeFromShape(shape: number[]): number {
182 if (shape.length === 0) {
183 // Scalar.
184 return 1;
185 }
186 let size = shape[0];
187 for (let i = 1; i < shape.length; i++) {
188 size *= shape[i];
189 }
190 return size;
191}
192
193export function isScalarShape(shape: number[]): boolean {
194 return shape.length === 0;

Callers 15

computeMaxSizePerColumnFunction · 0.90
onesFunction · 0.90
calculateShapesFunction · 0.90
meshgridFunction · 0.90
runConv3DTestCaseFunction · 0.90
makeTensorFunction · 0.90
prepareAndValidateFunction · 0.90
searchSorted_Function · 0.90
rand_Function · 0.90
zerosFunction · 0.90
onesFunction · 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…