public function back(Deferred $prevGradient, Optimizer $optimizer) : Deferred
    {
        if (!$this->mask) {
            throw new RuntimeException('Must perform forward pass before'
                . ' backpropagating.');
        }

        $mask = $this->mask;

        unset($this->mask);

        return new Deferred(function () use ($prevGradient, $mask) {
            return $prevGradient->result()->multiply($mask);
        });
    }
public function back(Deferred $prevGradient, Optimizer $optimizer) : Deferred
    {
        if (!$this->mask) {
            throw new RuntimeException('Must perform forward pass before'
                . ' backpropagating.');
        }

        $mask = $this->mask;

        unset($this->mask);

        return new Deferred(function () use ($prevGradient, $mask) {
            return $prevGradient->result()->multiply($mask);
        });
    }
public function back ( Deferred $ prevGradient , Optimizer $ optimizer ) : Deferred { if ( ! $ this -> mask ) { throw new RuntimeException ( 'Must perform forward pass before' . ' backpropagating.' ) ; } $ mask = $ this -> mask ; unset ( $ this -> mask ) ; return new Deferred ( function ( ) use ( $ prevGradient , $ mask ) { return $ prevGradient -> result ( ) -> multiply ( $ mask ) ; } ) ; }
Calculate the gradients of the layer and update the parameters.

@param \Rubix\ML\NeuralNet\Deferred $prevGradient
@param \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer
@throws \RuntimeException
@return \Rubix\ML\NeuralNet\Deferred
Calculate the gradients of the layer and update the parameters .