license import { DataType , NumericDataType , TypedArray , util } from '@tensorflow/tfjs-core' ; export function maxImpl ( aVals , reduceSize , outShape , dtype ) { const vals = util . getTypedArrayFromDType ( dtype as NumericDataType , util . sizeFromShape ( outShape ) ) ; for ( let i = 0 ; i < vals . length ; ++ i ) { const offset = i * reduceSize ; let max = aVals [ offset ] ; for ( let j = 0 ; j < reduceSize ; ++ j ) { const value = aVals [ offset + j ] ; if ( Number . isNaN ( value ) || value > max ) { max = value ; } } vals [ i ] = max ; } return vals ; }