(dtype: DataType)
| 490 | } |
| 491 | |
| 492 | export 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…