Apply gradients to parameters to minimise loss using RMSprop optimiser
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rmsprop_optimiser_type), | intent(inout) | :: | this |
Instance of the RMSprop optimiser |
||
| real(kind=real32), | intent(inout), | dimension(:) | :: | param |
Parameters |
|
| real(kind=real32), | intent(inout), | dimension(:) | :: | gradient |
Gradients |
pure subroutine minimise_rmsprop(this, param, gradient) !! Apply gradients to parameters to minimise loss using RMSprop optimiser implicit none ! Arguments class(rmsprop_optimiser_type), intent(inout) :: this !! Instance of the RMSprop optimiser real(real32), dimension(:), intent(inout) :: param !! Parameters real(real32), dimension(:), intent(inout) :: gradient !! Gradients ! Local variables real(real32) :: learning_rate !! Learning rate ! Decay learning rate and update iteration learning_rate = this%lr_decay%get_lr(this%learning_rate, this%iter) ! Apply regularisation if(this%regularisation) & call this%regulariser%regularise( param, gradient, learning_rate ) this%moving_avg = this%beta * this%moving_avg + & (1._real32 - this%beta) * gradient ** 2._real32 ! Update parameters param = param - learning_rate * gradient / & (sqrt(this%moving_avg + this%epsilon)) end subroutine minimise_rmsprop