From e4496efe3742f6aa412d49133f912566e479c1a2 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 19 Oct 2023 14:04:35 -0700 Subject: [PATCH 1/2] chore(example): rm redundant example print-network-properties.f90 did a subset of what write-read-infer.f90 does but the former doesn't run without a pre-existing JSON network file present, whereas the latter does. This commit removes print-network-properties.f90. --- example/print-network-properties.f90 | 35 ---------------------------- 1 file changed, 35 deletions(-) delete mode 100644 example/print-network-properties.f90 diff --git a/example/print-network-properties.f90 b/example/print-network-properties.f90 deleted file mode 100644 index b682bd8c1..000000000 --- a/example/print-network-properties.f90 +++ /dev/null @@ -1,35 +0,0 @@ -! Copyright (c), The Regents of the University of California -! Terms of use are as specified in LICENSE.txt -program read_json - !! This program demonstrates how to read a neural network from a JSON file. - !! query the network for a some of its properties. - use command_line_m, only : command_line_t - use inference_engine_m, only : inference_engine_t - use string_m, only : string_t - use file_m, only : file_t - implicit none - - type(string_t) input_file_name - type(command_line_t) command_line - type(inference_engine_t) inference_engine - type(string_t) activation_name - - input_file_name = string_t(command_line%flag_value("--input-file")) - - if (len(input_file_name%string())==0) then - error stop new_line('a') // new_line('a') // & - 'Usage: ./build/run-fpm.sh run --example read -- --input-file ""' - end if - - print *, "Constructing a new inference_engine_t object by parameters from '"//input_file_name%string()//"'." - inference_engine = inference_engine_t(file_t(input_file_name)) - print *, "number of inputs: ", inference_engine%num_inputs() - print *, "number of outputs: ", inference_engine%num_outputs() - associate(nodes => inference_engine%nodes_per_layer()) - print *, "number of layers: ", size(nodes) - print *, "number of nodes per layer: ", nodes - end associate - activation_name = inference_engine%activation_function_name() - print *, "activation function: ", activation_name%string() - print *, "using skip connections: ", merge("true ", "false", inference_engine%skip()) -end program From 3ecd1623614deb1c348cbc200817765ccdf24372 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 19 Oct 2023 14:18:01 -0700 Subject: [PATCH 2/2] fix(example): better .plt & json headers --- example/learn-saturated-mixing-ratio.f90 | 5 +++-- .../{ => supporting-modules}/saturated_mixing_ratio_m.f90 | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename example/{ => supporting-modules}/saturated_mixing_ratio_m.f90 (100%) diff --git a/example/learn-saturated-mixing-ratio.f90 b/example/learn-saturated-mixing-ratio.f90 index bd91a6fd4..e7936927c 100644 --- a/example/learn-saturated-mixing-ratio.f90 +++ b/example/learn-saturated-mixing-ratio.f90 @@ -185,7 +185,8 @@ function perturbed_identity_network(perturbation_magnitude, n) result(trainable_ trainable_engine = trainable_engine_t( & nodes = n, weights = w, biases = b, differentiable_activation_strategy = relu_t(), & metadata = & - [string_t("Perturbed Identity"), string_t("Damian Rouson"), string_t("2023-09-23"), string_t("relu"), string_t("false")] & + [string_t("Saturated Mixing Ratio"), string_t("Damian Rouson"), string_t("2023-09-23"), string_t("relu"), & + string_t("false")] & ) end associate end associate @@ -207,7 +208,7 @@ subroutine open_plot_file_for_appending(plot_file_name, plot_unit, previous_epoc inquire(file=plot_file_name, exist=preexisting_plot_file) open(newunit=plot_unit,file="cost.plt",status="unknown",position="append") - associate(header => "Epoch | Nodes/layer | System_clock | Cost function") + associate(header => " Epoch | Cost Function| System_Clock | Nodes per Layer") if (.not. preexisting_plot_file) then write(plot_unit,*) header previous_epoch = 0 diff --git a/example/saturated_mixing_ratio_m.f90 b/example/supporting-modules/saturated_mixing_ratio_m.f90 similarity index 100% rename from example/saturated_mixing_ratio_m.f90 rename to example/supporting-modules/saturated_mixing_ratio_m.f90