@Override
    public void preProcess(INDArray array, INDArray maskArray, DistributionStats stats) {
        if (array.rank() <= 2) {
            array.subiRowVector(stats.getMean());
            array.diviRowVector(filteredStd(stats));
        }
        // if array Rank is 3 (time series) samplesxfeaturesxtimesteps
        // if array Rank is 4 (images) samplesxchannelsxrowsxcols
        // both cases operations should be carried out in dimension 1
        else {
            Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getMean(), array, 1));
            Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, filteredStd(stats), array, 1));
        }

        if (maskArray != null) {
            DataSetUtil.setMaskedValuesToZero(array, maskArray);
        }
    }
@ Override public void preProcess ( INDArray array , INDArray maskArray , DistributionStats stats ) { if ( array . rank ( ) <= 2 ) { array . subiRowVector ( stats . getMean ( ) ) ; array . diviRowVector ( filteredStd ( stats ) ) ; } else { Nd4j . getExecutioner ( ) . execAndReturn ( new BroadcastSubOp ( array , stats . getMean ( ) , array , 1 ) ) ; Nd4j . getExecutioner ( ) . execAndReturn ( new BroadcastDivOp ( array , filteredStd ( stats ) , array , 1 ) ) ; } if ( maskArray != null ) { DataSetUtil . setMaskedValuesToZero ( array , maskArray ) ; } }
Normalize a data array

@param array the data to normalize
@param stats statistics of the data population