(array: number[]|Float32Array)
| 79 | * @return maximum value |
| 80 | */ |
| 81 | export function max(array: number[]|Float32Array): number { |
| 82 | // same behavior as tf.max() |
| 83 | if (array.length === 0) { |
| 84 | return Number.NaN; |
| 85 | } |
| 86 | let max = Number.NEGATIVE_INFINITY; |
| 87 | for (let i = 0; i < array.length; i++) { |
| 88 | const value = array[i]; |
| 89 | if (value > max) { |
| 90 | max = value; |
| 91 | } |
| 92 | } |
| 93 | return max; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Compute sum of array. |
no outgoing calls
no test coverage detected