Initialise gradients for SGD optimiser
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sgd_optimiser_type), | intent(inout) | :: | this |
Instance of the SGD optimiser |
||
| integer, | intent(in) | :: | num_params |
Number of parameters |
pure subroutine init_gradients_sgd(this, num_params) !! Initialise gradients for SGD optimiser implicit none ! Arguments class(sgd_optimiser_type), intent(inout) :: this !! Instance of the SGD optimiser integer, intent(in) :: num_params !! Number of parameters ! Initialise gradients if(allocated(this%velocity)) deallocate(this%velocity) allocate(this%velocity(num_params), source=0._real32) end subroutine init_gradients_sgd