(shape: number[])
| 179 | * @doc {heading: 'Util', namespace: 'util'} |
| 180 | */ |
| 181 | export 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 | |
| 193 | export function isScalarShape(shape: number[]): boolean { |
| 194 | return shape.length === 0; |
no outgoing calls
no test coverage detected
searching dependent graphs…