apply_attributes_tanh Subroutine

private subroutine apply_attributes_tanh(this, attributes)

Load ONNX attributes into tanh activation function

Type Bound

tanh_actv_type

Arguments

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

Tanh activation type

type(onnx_attribute_type), intent(in), dimension(:) :: attributes

Array of ONNX attributes


Source Code

  subroutine apply_attributes_tanh(this, attributes)
    !! Load ONNX attributes into tanh activation function
    implicit none

    ! Arguments
    class(tanh_actv_type), intent(inout) :: this
    !! Tanh activation type
    type(onnx_attribute_type), dimension(:), intent(in) :: attributes
    !! Array of ONNX attributes

    ! Local variables
    integer :: i
    !! Loop variable

    ! Load provided attributes
    do i=1, size(attributes,dim=1)
       select case(trim(attributes(i)%name))
       case("scale")
          read(attributes(i)%val,*) this%scale
          if(abs(this%scale-1._real32) .gt. 1.e-6_real32)then
             this%apply_scaling = .true.
          else
             this%apply_scaling = .false.
          end if
       case("name")
          if(trim(attributes(i)%val) .ne. trim(this%name))then
             call print_warning( &
                  'Tanh activation: name attribute "' // &
                  trim(attributes(i)%val) // &
                  '"" does not match expected "' // trim(this%name)//'"' &
             )

          end if
       case default
          call print_warning( &
               'Tanh activation: unknown attribute '//trim(attributes(i)%name) &
          )
       end select
    end do

  end subroutine apply_attributes_tanh