set_hyperparams_actv Subroutine

private subroutine set_hyperparams_actv(this, activation, input_rank, verbose)

Uses

Set hyperparameters for activation layer

Type Bound

actv_layer_type

Arguments

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

Instance of the activation layer

class(base_actv_type), intent(in), allocatable :: activation

Activation function

integer, intent(in), optional :: input_rank

Input rank

integer, intent(in), optional :: verbose

Verbosity level


Source Code

  subroutine set_hyperparams_actv( &
       this, &
       activation, &
       input_rank, &
       verbose &
  )
    !! Set hyperparameters for activation layer
    use athena__activation,  only: activation_setup
    use coreutils, only: to_lower
    implicit none

    ! Arguments
    class(actv_layer_type), intent(inout) :: this
    !! Instance of the activation layer
    integer, optional, intent(in) :: input_rank
    !! Input rank
    class(base_actv_type), allocatable, intent(in) :: activation
    !! Activation function
    integer, optional, intent(in) :: verbose
    !! Verbosity level


    this%name = "actv"
    this%type = "actv"
    this%input_rank = 0
    if(present(input_rank)) this%input_rank = input_rank
    this%output_rank = this%input_rank
    if(.not.allocated(activation))then
       this%activation = activation_setup("none")
    else
       if(allocated(this%activation)) deallocate(this%activation)
       allocate(this%activation, source=activation)
    end if
    this%subtype = trim(to_lower(this%activation%name))

    if(present(verbose))then
       if(abs(verbose).gt.0)then
          write(*,'("ACTV activation function: ",A)') &
               trim(this%activation%name)
       end if
    end if

  end subroutine set_hyperparams_actv