MCPcopy Create free account
hub / github.com/tensorflow/tfjs / max

Function max

tfjs-layers/src/utils/math_utils.ts:81–94  ·  view source on GitHub ↗
(array: number[]|Float32Array)

Source from the content-addressed store, hash-verified

79 * @return maximum value
80 */
81export 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.

Callers 7

deconvLengthFunction · 0.90
computeDatasetStatisticsFunction · 0.50
callMethod · 0.50
max.tsFile · 0.50
logSoftmax_Function · 0.50
normImplFunction · 0.50
logSumExp_Function · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected