From 8b71baeb6e5d344f89a4855d58dc4df080d0576b Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 31 Oct 2023 18:45:06 -0700 Subject: [PATCH] feat(exampl): add print-training-configuration.f90 replaces print-sample-input-file.f90 --- example/print-sample-input-file.f90 | 24 ------------------------ example/print-training-configuration.f90 | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 24 deletions(-) delete mode 100644 example/print-sample-input-file.f90 create mode 100644 example/print-training-configuration.f90 diff --git a/example/print-sample-input-file.f90 b/example/print-sample-input-file.f90 deleted file mode 100644 index b8cc6922a..000000000 --- a/example/print-sample-input-file.f90 +++ /dev/null @@ -1,24 +0,0 @@ -program print_sample_input_file - use inference_engine_m, only : hyperparameters_t, network_configuration_t - implicit none - - associate(params => hyperparameters_t(mini_batches=10, learning_rate=1.5, optimizer = "adam")) - associate(net_conf=> network_configuration_t(skip_connections=.false., nodes_per_layer=[2,72,2], activation_function="sigmoid")) - associate(params_json => params%to_json(), net_json => net_conf%to_json()) - print *,"{" - block - integer line - do line = 1, size(params_json) - print *, (params_json(line)%string()) - end do - do line = 1, size(net_json) - print *, (net_json(line)%string()) - end do - end block - print *,"}" - end associate - end associate - end associate - - -end program diff --git a/example/print-training-configuration.f90 b/example/print-training-configuration.f90 new file mode 100644 index 000000000..c002286c2 --- /dev/null +++ b/example/print-training-configuration.f90 @@ -0,0 +1,15 @@ +program print_training_configuration + !! Demonstrate how to construct and print a training_configuration_t object + use inference_engine_m, only : training_configuration_t, hyperparameters_t, network_configuration_t + use sourcery_m, only : file_t + implicit none + + associate(training_configuration => training_configuration_t( & + hyperparameters_t(mini_batches=10, learning_rate=1.5, optimizer = "adam"), & + network_configuration_t(skip_connections=.false., nodes_per_layer=[2,72,2], activation_function="sigmoid") & + )) + associate(json_file => file_t(training_configuration%to_json())) + call json_file%write_lines() + end associate + end associate +end program