train_and_write Program

Uses

  • program~~train_and_write~~UsesGraph program~train_and_write train_and_write assert_m assert_m program~train_and_write->assert_m julienne_m julienne_m program~train_and_write->julienne_m module~fiats_m fiats_m program~train_and_write->module~fiats_m module~double_precision_file_m double_precision_file_m module~fiats_m->module~double_precision_file_m module~double_precision_string_m double_precision_string_m module~fiats_m->module~double_precision_string_m module~hyperparameters_m hyperparameters_m module~fiats_m->module~hyperparameters_m module~input_output_pair_m input_output_pair_m module~fiats_m->module~input_output_pair_m module~kind_parameters_m kind_parameters_m module~fiats_m->module~kind_parameters_m module~metadata_m metadata_m module~fiats_m->module~metadata_m module~mini_batch_m mini_batch_m module~fiats_m->module~mini_batch_m module~network_configuration_m network_configuration_m module~fiats_m->module~network_configuration_m module~neural_network_m neural_network_m module~fiats_m->module~neural_network_m module~tensor_m tensor_m module~fiats_m->module~tensor_m module~tensor_map_m tensor_map_m module~fiats_m->module~tensor_map_m module~tensor_names_m tensor_names_m module~fiats_m->module~tensor_names_m module~trainable_network_m trainable_network_m module~fiats_m->module~trainable_network_m module~training_configuration_m training_configuration_m module~fiats_m->module~training_configuration_m module~double_precision_file_m->julienne_m module~double_precision_file_m->module~double_precision_string_m module~double_precision_string_m->julienne_m module~hyperparameters_m->module~double_precision_string_m module~hyperparameters_m->module~kind_parameters_m julienne_string_m julienne_string_m module~hyperparameters_m->julienne_string_m module~input_output_pair_m->module~kind_parameters_m module~input_output_pair_m->module~tensor_m module~metadata_m->module~double_precision_string_m module~metadata_m->julienne_string_m module~mini_batch_m->module~input_output_pair_m module~mini_batch_m->module~kind_parameters_m module~network_configuration_m->module~double_precision_string_m module~network_configuration_m->julienne_string_m module~neural_network_m->julienne_m module~neural_network_m->module~double_precision_file_m module~neural_network_m->module~kind_parameters_m module~neural_network_m->module~metadata_m module~neural_network_m->module~mini_batch_m module~neural_network_m->module~tensor_m module~neural_network_m->module~tensor_map_m module~activation_m activation_m module~neural_network_m->module~activation_m module~tensor_m->module~kind_parameters_m module~tensor_map_m->julienne_m module~tensor_map_m->module~double_precision_string_m module~tensor_map_m->module~kind_parameters_m module~tensor_map_m->module~tensor_m module~tensor_names_m->julienne_string_m module~trainable_network_m->julienne_m module~trainable_network_m->module~input_output_pair_m module~trainable_network_m->module~kind_parameters_m module~trainable_network_m->module~mini_batch_m module~trainable_network_m->module~neural_network_m module~trainable_network_m->module~tensor_map_m module~trainable_network_m->module~training_configuration_m module~training_configuration_m->module~double_precision_file_m module~training_configuration_m->module~hyperparameters_m module~training_configuration_m->module~kind_parameters_m module~training_configuration_m->module~network_configuration_m module~training_configuration_m->module~tensor_names_m julienne_file_m julienne_file_m module~training_configuration_m->julienne_file_m module~training_configuration_m->julienne_string_m module~training_configuration_m->module~activation_m module~activation_m->julienne_m iso_c_binding iso_c_binding module~activation_m->iso_c_binding

This program demonstrates how to train a simple neural network starting from a randomized initial condition and how to write the initial network and the trained network to separate JSON files. The network has two hiden layers. The input, hidden, and output layers are all two nodes wide. The training data has outputs that identically match the corresponding inputs. Hence, the desired network represents an identity mapping. With RELU activation functions, the desired network therefore contains weights corresponding to identity matrices and biases that vanish everywhere. The initial condition corresponds to the desired network with all weights and biases perturbed by a random variable that is uniformly distributed on the range [0,0.1].


Calls

program~~train_and_write~~CallsGraph program~train_and_write train_and_write assert assert program~train_and_write->assert bin_t bin_t program~train_and_write->bin_t bins bins program~train_and_write->bins cost cost program~train_and_write->cost first first program~train_and_write->first flag_value flag_value program~train_and_write->flag_value infer infer program~train_and_write->infer input_output_pairs input_output_pairs program~train_and_write->input_output_pairs inputs inputs program~train_and_write->inputs interface~shuffle shuffle program~train_and_write->interface~shuffle intrinsic_array_t intrinsic_array_t program~train_and_write->intrinsic_array_t last last program~train_and_write->last mini_batches mini_batches program~train_and_write->mini_batches network_outputs network_outputs program~train_and_write->network_outputs num_inputs num_inputs program~train_and_write->num_inputs num_outputs num_outputs program~train_and_write->num_outputs proc~output~4 output program~train_and_write->proc~output~4 proc~perturbed_identity_network~4 perturbed_identity_network program~train_and_write->proc~perturbed_identity_network~4 random_init random_init program~train_and_write->random_init random_numbers random_numbers program~train_and_write->random_numbers string string program~train_and_write->string string_t string_t program~train_and_write->string_t train train program~train_and_write->train values values program~train_and_write->values none~to_json~6 neural_network_t%to_json proc~output~4->none~to_json~6 write_lines write_lines proc~output~4->write_lines proc~perturbed_identity_network~4->string_t proc~e~4 e proc~perturbed_identity_network~4->proc~e~4 interface~default_real_to_json~3 neural_network_t%default_real_to_json none~to_json~6->interface~default_real_to_json~3 interface~double_precision_to_json~3 neural_network_t%double_precision_to_json none~to_json~6->interface~double_precision_to_json~3

Variables

Type Attributes Name Initial
type(command_line_t) :: command_line
type(string_t) :: final_network_file

Functions

pure function e(m, n) result(e_mn)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: m
integer, intent(in) :: n

Return Value real

function perturbed_identity_network(perturbation_magnitude) result(trainable_network)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: perturbation_magnitude

Return Value type(trainable_network_t)


Subroutines

subroutine output(neural_network, file_name)

Arguments

Type IntentOptional Attributes Name
class(neural_network_t), intent(in) :: neural_network
type(string_t), intent(in) :: file_name