zero_grad Module Subroutine

module subroutine zero_grad(this)

Zero the gradients of this array

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this

Source Code

  module subroutine zero_grad(this)
    !! Zero the gradients of this array
    implicit none
    class(array_type), intent(inout) :: this

    if(associated(this%grad))then
       if(allocated(this%grad%val)) this%grad%val = 0.0_real32
    end if
  end subroutine zero_grad