@Override
    public void applyUpdater(INDArray gradient, int iteration, int epoch) {
    """
	Calculate the update based on the given gradient
	
	@param gradient  the gradient to get the update for
	@param iteration
	@return the gradient
    """
        if (m == null || v == null)
            throw new IllegalStateException("Updater has not been initialized with view state");

        double beta1 = config.getBeta1();
        double beta2 = config.getBeta2();
        double learningRate = config.getLearningRate(iteration, epoch);
        double epsilon = config.getEpsilon();

        INDArray oneMinusBeta1Grad = gradient.mul(1.0 - beta1);
        m.muli(beta1).addi(oneMinusBeta1Grad);

        INDArray oneMinusBeta2GradSquared = gradient.mul(gradient).muli(1 - beta2);
        v.muli(beta2).addi(oneMinusBeta2GradSquared);

        double beta1t = FastMath.pow(beta1, iteration + 1);
        double beta2t = FastMath.pow(beta2, iteration + 1);

        double alphat = learningRate * FastMath.sqrt(1 - beta2t) / (1 - beta1t);
        if (Double.isNaN(alphat) || alphat == 0.0)
            alphat = epsilon;
        INDArray sqrtV = Transforms.sqrt(v.dup(gradientReshapeOrder), false).addi(epsilon);

        gradient.assign(m).muli(alphat).divi(sqrtV);
    }
@Override
    public void applyUpdater(INDArray gradient, int iteration, int epoch) {
        if (m == null || v == null)
            throw new IllegalStateException("Updater has not been initialized with view state");

        double beta1 = config.getBeta1();
        double beta2 = config.getBeta2();
        double learningRate = config.getLearningRate(iteration, epoch);
        double epsilon = config.getEpsilon();

        INDArray oneMinusBeta1Grad = gradient.mul(1.0 - beta1);
        m.muli(beta1).addi(oneMinusBeta1Grad);

        INDArray oneMinusBeta2GradSquared = gradient.mul(gradient).muli(1 - beta2);
        v.muli(beta2).addi(oneMinusBeta2GradSquared);

        double beta1t = FastMath.pow(beta1, iteration + 1);
        double beta2t = FastMath.pow(beta2, iteration + 1);

        double alphat = learningRate * FastMath.sqrt(1 - beta2t) / (1 - beta1t);
        if (Double.isNaN(alphat) || alphat == 0.0)
            alphat = epsilon;
        INDArray sqrtV = Transforms.sqrt(v.dup(gradientReshapeOrder), false).addi(epsilon);

        gradient.assign(m).muli(alphat).divi(sqrtV);
    }
@ Override public void applyUpdater ( INDArray gradient , int iteration , int epoch ) { if ( m == null || v == null ) throw new IllegalStateException ( "Updater has not been initialized with view state" ) ; double beta1 = config . getBeta1 ( ) ; double beta2 = config . getBeta2 ( ) ; double learningRate = config . getLearningRate ( iteration , epoch ) ; double epsilon = config . getEpsilon ( ) ; INDArray oneMinusBeta1Grad = gradient . mul ( 1.0 - beta1 ) ; m . muli ( beta1 ) . addi ( oneMinusBeta1Grad ) ; INDArray oneMinusBeta2GradSquared = gradient . mul ( gradient ) . muli ( 1 - beta2 ) ; v . muli ( beta2 ) . addi ( oneMinusBeta2GradSquared ) ; double beta1t = FastMath . pow ( beta1 , iteration + 1 ) ; double beta2t = FastMath . pow ( beta2 , iteration + 1 ) ; double alphat = learningRate * FastMath . sqrt ( 1 - beta2t ) / ( 1 - beta1t ) ; if ( Double . isNaN ( alphat ) || alphat == 0.0 ) alphat = epsilon ; INDArray sqrtV = Transforms . sqrt ( v . dup ( gradientReshapeOrder ) , false ) . addi ( epsilon ) ; gradient . assign ( m ) . muli ( alphat ) . divi ( sqrtV ) ; }
Calculate the update based on the given gradient

@param gradient  the gradient to get the update for
@param iteration
@return the gradient
Calculate the update based on the given gradient