Set the metrics for the network
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(network_type), | intent(inout) | :: | this |
Instance of network |
||
| class(*), | intent(in), | dimension(..) | :: | metrics |
Metrics |
module subroutine set_metrics(this, metrics) !! Set the metrics for the network use coreutils, only: to_lower implicit none ! Arguments class(network_type), intent(inout) :: this !! Instance of network class(*), dimension(..), intent(in) :: metrics !! Metrics ! Local variables integer :: i !! Loop index this%metrics%active = .false. this%metrics(1)%key = "loss" this%metrics(2)%key = "accuracy" this%metrics%threshold = 1.E-1_real32 select rank(metrics) #if defined(GFORTRAN) rank(0) select type(metrics) type is(character(*)) ! ERROR: ifort cannot identify that the rank of metrics has been ... ! ... identified as scalar here where(to_lower(trim(metrics)).eq.this%metrics%key) this%metrics%active = .true. end where end select #endif rank(1) select type(metrics) type is(character(*)) do i=1,size(metrics,1) where(to_lower(trim(metrics(i))).eq.this%metrics%key) this%metrics%active = .true. end where end do type is(metric_dict_type) if(size(metrics,1).eq.2)then this%metrics(:2) = metrics(:2) else call stop_program("invalid length array for metric_dict_type") return end if end select rank default call stop_program("provided metrics rank in compile invalid") return end select end subroutine set_metrics