Setup the network
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(container_layer_type), | intent(in), | dimension(:) | :: | layers |
Layers to add to the network |
|
| class(base_optimiser_type), | intent(in), | optional | :: | optimiser |
Optimiser to use for training |
|
| class(*), | intent(in), | optional | :: | loss_method |
Loss method |
|
| character(len=*), | intent(in), | optional | :: | accuracy_method |
Accuracy method |
|
| class(*), | intent(in), | optional, | dimension(..) | :: | metrics |
Metrics |
| integer, | intent(in), | optional | :: | batch_size |
Batch size |
Network to setup
module function network_setup( & layers, optimiser, loss_method, accuracy_method, & metrics, batch_size & ) result(network) !! Setup the network implicit none ! Arguments type(container_layer_type), dimension(:), intent(in) :: layers !! Layers to add to the network class(base_optimiser_type), optional, intent(in) :: optimiser !! Optimiser to use for training class(*), optional, intent(in) :: loss_method !! Loss method character(*), optional, intent(in) :: accuracy_method !! Accuracy method class(*), dimension(..), optional, intent(in) :: metrics !! Metrics integer, optional, intent(in) :: batch_size !! Batch size type(network_type) :: network !! Network to setup ! Local variables integer :: l !! Loop index !--------------------------------------------------------------------------- ! Handle optional arguments !--------------------------------------------------------------------------- if(present(loss_method)) call network%set_loss(loss_method) if(present(accuracy_method)) call network%set_accuracy(accuracy_method) if(present(metrics)) call network%set_metrics(metrics) if(present(batch_size)) network%batch_size = batch_size network%auto_graph%directed = .true. !--------------------------------------------------------------------------- ! Add layers to network !--------------------------------------------------------------------------- do l = 1, size(layers) call network%add(layers(l)%layer) end do !--------------------------------------------------------------------------- ! Compile network if optimiser present !--------------------------------------------------------------------------- if(present(optimiser)) call network%compile(optimiser) end function network_setup