neural_network_t Derived Type

type, public :: neural_network_t

Encapsulate the information needed to perform inference


Inherits

type~~neural_network_t~~InheritsGraph type~neural_network_t neural_network_t type~activation_t activation_t type~neural_network_t->type~activation_t activation_ type~metadata_t metadata_t type~neural_network_t->type~metadata_t metadata_ type~tensor_map_t tensor_map_t type~neural_network_t->type~tensor_map_t input_map_, output_map_ string_t string_t type~metadata_t->string_t modelName_, modelAuthor_, compilationDate_, activationFunction_, usingSkipConnections_

Inherited by

type~~neural_network_t~~InheritedByGraph type~neural_network_t neural_network_t type~trainable_network_t trainable_network_t type~trainable_network_t->type~neural_network_t type~unmapped_network_t unmapped_network_t type~unmapped_network_t->type~neural_network_t neural_network_

Components

Type Visibility Attributes Name Initial
integer, public, kind :: k = default_real
type(activation_t), private :: activation_
real(kind=k), private, allocatable :: biases_(:,:)
type(tensor_map_t(k)), private :: input_map_
type(metadata_t), private :: metadata_
integer, private, allocatable :: nodes_(:)
type(tensor_map_t(k)), private :: output_map_
real(kind=k), private, allocatable :: weights_(:,:,:)

Constructor

public interface neural_network_t

  • private module function default_real_construct_from_components(metadata, weights, biases, nodes, input_map, output_map) result(neural_network)

    Arguments

    Type IntentOptional Attributes Name
    type(string_t), intent(in) :: metadata(:)
    real, intent(in) :: weights(:,:,:)
    real, intent(in) :: biases(:,:)
    integer, intent(in) :: nodes(0:)
    type(tensor_map_t), intent(in), optional :: input_map
    type(tensor_map_t), intent(in), optional :: output_map

    Return Value type(neural_network_t)

  • private impure elemental module function default_real_from_json(file_) result(neural_network)

    Arguments

    Type IntentOptional Attributes Name
    type(file_t), intent(in) :: file_

    Return Value type(neural_network_t)

  • private module function double_precision_construct_from_components(metadata, weights, biases, nodes, input_map, output_map) result(neural_network)

    Arguments

    Type IntentOptional Attributes Name
    type(metadata_t), intent(in) :: metadata
    double precision, intent(in) :: weights(:,:,:)
    double precision, intent(in) :: biases(:,:)
    integer, intent(in) :: nodes(0:)
    type(tensor_map_t(double_precision)), intent(in), optional :: input_map
    type(tensor_map_t(double_precision)), intent(in), optional :: output_map

    Return Value type(neural_network_t(double_precision))

  • private impure elemental module function double_precision_from_json(file) result(neural_network)

    Arguments

    Type IntentOptional Attributes Name
    type(double_precision_file_t), intent(in) :: file

    Return Value type(neural_network_t(double_precision))


Type-Bound Procedures

generic, public :: activation_function_name => default_real_activation_name, double_precision_activation_name

generic, public :: infer => default_real_infer, double_precision_infer

generic, public :: learn => default_real_learn

generic, public :: map_from_output_range => default_real_map_from_output_range, double_precision_map_from_output_range

generic, public :: map_to_input_range => default_real_map_to_input_range, double_precision_map_to_input_range

generic, public :: nodes_per_layer => default_real_nodes_per_layer, double_precision_nodes_per_layer

generic, public :: num_hidden_layers => default_real_num_hidden_layers, double_precision_num_hidden_layers

generic, public :: num_inputs => default_real_num_inputs, double_precision_num_inputs

generic, public :: num_outputs => default_real_num_outputs, double_precision_num_outputs

generic, public :: skip => default_real_skip, double_precision_skip

generic, public :: to_json => default_real_to_json, double_precision_to_json

procedure, private, non_overridable :: default_real_activation_name

  • interface

    private elemental module function default_real_activation_name(self) result(activation_name)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value type(string_t)

procedure, private, non_overridable :: default_real_approximately_equal

  • interface

    private elemental module function default_real_approximately_equal(lhs, rhs) result(lhs_eq_rhs)

    The result is true if lhs and rhs are the same to within a tolerance

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: lhs
    class(neural_network_t), intent(in) :: rhs

    Return Value logical

procedure, private, non_overridable :: default_real_infer

  • interface

    private elemental module function default_real_infer(self, inputs) result(outputs)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self
    type(tensor_t), intent(in) :: inputs

    Return Value type(tensor_t)

procedure, private, non_overridable :: default_real_learn

  • interface

    private pure module subroutine default_real_learn(self, mini_batches_arr, cost, adam, learning_rate, workspace)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(inout) :: self
    type(mini_batch_t), intent(in) :: mini_batches_arr(:)
    real, intent(out), optional, allocatable :: cost(:)
    logical, intent(in) :: adam
    real, intent(in) :: learning_rate
    type(workspace_t), intent(inout) :: workspace

procedure, private, non_overridable :: default_real_map_from_output_range

  • interface

    private elemental module function default_real_map_from_output_range(self, normalized_tensor) result(tensor)

    The result contains the output tensor values unmapped via the inverse of the mapping used in training

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self
    type(tensor_t), intent(in) :: normalized_tensor

    Return Value type(tensor_t)

procedure, private, non_overridable :: default_real_map_to_input_range

  • interface

    private elemental module function default_real_map_to_input_range(self, tensor) result(normalized_tensor)

    The result contains the input tensor values normalized to fall on the range used during training

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self
    type(tensor_t), intent(in) :: tensor

    Return Value type(tensor_t)

procedure, private, non_overridable :: default_real_nodes_per_layer

  • interface

    private pure module function default_real_nodes_per_layer(self) result(node_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value integer, allocatable, (:)

procedure, private, non_overridable :: default_real_num_hidden_layers

  • interface

    private elemental module function default_real_num_hidden_layers(self) result(hidden_layer_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: default_real_num_inputs

  • interface

    private elemental module function default_real_num_inputs(self) result(input_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: default_real_num_outputs

  • interface

    private elemental module function default_real_num_outputs(self) result(output_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: default_real_skip

  • interface

    private pure module function default_real_skip(self) result(use_skip_connections)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value logical

procedure, private, non_overridable :: default_real_to_json

  • interface

    private impure elemental module function default_real_to_json(self) result(json_file)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t), intent(in) :: self

    Return Value type(file_t)

procedure, private, non_overridable :: double_precision_activation_name

  • interface

    private elemental module function double_precision_activation_name(self) result(activation_name)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value type(string_t)

procedure, private, non_overridable :: double_precision_approximately_equal

  • interface

    private elemental module function double_precision_approximately_equal(lhs, rhs) result(lhs_eq_rhs)

    The result is true if lhs and rhs are the same to within a tolerance

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: lhs
    class(neural_network_t(double_precision)), intent(in) :: rhs

    Return Value logical

procedure, private, non_overridable :: double_precision_infer

  • interface

    private elemental module function double_precision_infer(self, inputs) result(outputs)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self
    type(tensor_t(double_precision)), intent(in) :: inputs

    Return Value type(tensor_t(double_precision))

procedure, private, non_overridable :: double_precision_map_from_output_range

  • interface

    private elemental module function double_precision_map_from_output_range(self, normalized_tensor) result(tensor)

    The result contains the output tensor values unmapped via the inverse of the mapping used in training

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self
    type(tensor_t(double_precision)), intent(in) :: normalized_tensor

    Return Value type(tensor_t(double_precision))

procedure, private, non_overridable :: double_precision_map_to_input_range

  • interface

    private elemental module function double_precision_map_to_input_range(self, tensor) result(normalized_tensor)

    The result contains the input tensor values normalized to fall on the range used during training

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self
    type(tensor_t(double_precision)), intent(in) :: tensor

    Return Value type(tensor_t(double_precision))

procedure, private, non_overridable :: double_precision_nodes_per_layer

  • interface

    private pure module function double_precision_nodes_per_layer(self) result(node_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value integer, allocatable, (:)

procedure, private, non_overridable :: double_precision_num_hidden_layers

  • interface

    private elemental module function double_precision_num_hidden_layers(self) result(hidden_layer_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: double_precision_num_inputs

  • interface

    private elemental module function double_precision_num_inputs(self) result(input_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: double_precision_num_outputs

  • interface

    private elemental module function double_precision_num_outputs(self) result(output_count)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value integer

procedure, private, non_overridable :: double_precision_skip

  • interface

    private pure module function double_precision_skip(self) result(use_skip_connections)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value logical

procedure, private, non_overridable :: double_precision_to_json

  • interface

    private impure elemental module function double_precision_to_json(self) result(json_file)

    Arguments

    Type IntentOptional Attributes Name
    class(neural_network_t(double_precision)), intent(in) :: self

    Return Value type(file_t)