athena__network Module

Module containing the network class used to define a neural network

This module contains the types and interfaces for the network class used to define a neural network. The network class is used to define a neural network with overloaded procedures for training, testing, predicting, and updating the network. The network class is also used to define the network structure and compile the network with an optimiser, loss function, and accuracy function.


Used by


Interfaces

public interface network_type

Interface for setting up the network (network initialisation)

  • private module function network_setup(layers, optimiser, loss_method, accuracy_method, metrics, batch_size) result(network)

    Set up the network

    Arguments

    Type IntentOptional Attributes Name
    type(container_layer_type), intent(in), dimension(:) :: layers

    Layers

    class(base_optimiser_type), intent(in), optional :: optimiser

    Optimiser

    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

    Return Value type(network_type)

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function accuracy_eval(this, output, start_index, end_index) result(accuracy)

    Get the accuracy for the output

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of network

    class(*), intent(in), dimension(:,:) :: output

    Output

    integer, intent(in) :: start_index

    Start and end batch indices

    integer, intent(in) :: end_index

    Start and end batch indices

    Return Value real(kind=real32)

    Accuracy value

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine add(this, layer, input_list, output_list, operator)

    Add a layer to the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(base_layer_type), intent(in) :: layer

    Layer to add

    integer, intent(in), optional, dimension(:) :: input_list

    Input and output list

    integer, intent(in), optional, dimension(:) :: output_list

    Input and output list

    class(*), intent(in), optional :: operator

    Operator

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine build_from_onnx(this, nodes, initialisers, inputs, value_info, verbose)

    Build network from ONNX nodes and initialisers

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    type(onnx_node_type), intent(in), dimension(:) :: nodes

    Array of ONNX nodes

    type(onnx_initialiser_type), intent(in), dimension(:) :: initialisers

    Array of ONNX initialisers

    type(onnx_tensor_type), intent(in), dimension(:) :: inputs

    Array of ONNX input tensors

    type(onnx_tensor_type), intent(in), dimension(:) :: value_info

    Array of ONNX value info tensors

    integer, intent(in), optional :: verbose

    Verbosity level

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine build_leaf_vertices(this)

    Calculate output vertices

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine build_root_vertices(this)

    Calculate root vertices

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine build_vertex_order(this)

    Generate vertex order

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine compile(this, optimiser, loss_method, accuracy_method, metrics, batch_size, verbose)

    Compile the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(base_optimiser_type), intent(in), optional :: optimiser

    Optimiser

    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

    integer, intent(in), optional :: verbose

    Verbosity level

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private recursive module subroutine dfs(this, vertex_index, visited, order, order_index)

    Depth first search

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    integer, intent(in) :: vertex_index

    Vertex index

    logical, intent(inout), dimension(this%auto_graph%num_vertices) :: visited

    Visited vertices

    integer, intent(inout), dimension(this%auto_graph%num_vertices) :: order

    Order of vertices

    integer, intent(inout) :: order_index

    Index of order

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine extract_output_real(this, output)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of network

    real(kind=real32), intent(out), dimension(..), allocatable :: output

    Output

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function forward_eval(this, input) result(output)

    Forward pass evaluation

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    class(*), intent(in), dimension(:,:) :: input

    Input data

    Return Value type(array_type), pointer, (:,:)

    Output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function forward_eval_multi(this, input) result(output)

    Forward pass evaluation for multiple outputs

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    class(*), intent(in), dimension(:,:) :: input

    Input data

    Return Value type(array_ptr_type), pointer, (:)

    Output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine forward_generic2d(this, input)

    Forward pass for generic 2D input

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    class(*), intent(in), dimension(:,:) :: input

    Input data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private pure module function get_gradients(this) result(gradients)

    Get gradients of learnable parameters

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    Return Value real(kind=real32), dimension(this%num_params)

    Gradients

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private pure module function get_num_params(this) result(num_params)

    Get number of learnable parameters in the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    Return Value integer

    Number of parameters

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function get_output(this) result(output)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    Return Value type(array_type), dimension(:,:), allocatable

    Output

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function get_output_shape(this) result(output_shape)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    Return Value integer, dimension(2)

    Output shape

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private pure module function get_params(this) result(params)

    Get learnable parameters

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    Return Value real(kind=real32), dimension(this%num_params)

    Learnable parameters

private interface get_sample

  • private module function get_sample_array(input, start_index, end_index, batch_size, as_graph) result(sample)

    Get sample for mixed input

    Arguments

    Type IntentOptional Attributes Name
    class(array_type), intent(in), dimension(:,:) :: input

    Input array

    integer, intent(in) :: start_index

    Start and end indices

    integer, intent(in) :: end_index

    Start and end indices

    integer, intent(in) :: batch_size

    Batch size

    logical, intent(in) :: as_graph

    Boolean whether to treat the input as a graph

    Return Value type(array_type), dimension(:,:), allocatable

    Sample array

  • private module function get_sample_flang(input, start_index, end_index, batch_size) result(sample)

    Get a sample from a rank

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in), dimension(..) :: input

    Input array

    integer, intent(in) :: start_index

    Start and end indices

    integer, intent(in) :: end_index

    Start and end indices

    integer, intent(in) :: batch_size

    Batch size

    Return Value real(kind=real32), allocatable, (:,:)

    Sample array

  • private module function get_sample_graph1d(input, start_index, end_index, batch_size) result(sample)

    Get sample for graph input

    Arguments

    Type IntentOptional Attributes Name
    class(graph_type), intent(in), dimension(:) :: input

    Input array

    integer, intent(in) :: start_index

    Start and end indices

    integer, intent(in) :: end_index

    Start and end indices

    integer, intent(in) :: batch_size

    Batch size

    Return Value type(graph_type), dimension(1, batch_size)

    Sample array

  • private module function get_sample_graph2d(input, start_index, end_index, batch_size) result(sample)

    Get sample for graph input

    Arguments

    Type IntentOptional Attributes Name
    class(graph_type), intent(in), dimension(:,:) :: input

    Input array

    integer, intent(in) :: start_index

    Start and end indices

    integer, intent(in) :: end_index

    Start and end indices

    integer, intent(in) :: batch_size

    Batch size

    Return Value type(graph_type), dimension(size(input,1), batch_size)

    Sample array

  • private module function get_sample_ptr(input, start_index, end_index, batch_size) result(sample_ptr)

    Get a sample from a rank

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in), dimension(..), target :: input

    Input array

    integer, intent(in) :: start_index

    Start and end indices

    integer, intent(in) :: end_index

    Start and end indices

    integer, intent(in) :: batch_size

    Batch size

    Return Value real(kind=real32), pointer, (:,:)

    Pointer to sample

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function inverse_design_array_0d(this, target, x_init, optimiser, steps) result(x_opt)

    Optimise input to match a target output (array_type inputs)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    type(array_type), intent(in) :: target

    Target output values

    type(array_type), intent(in) :: x_init

    Initial input values

    class(base_optimiser_type), intent(in), optional :: optimiser

    Optimiser for input updates (defaults to network optimiser)

    integer, intent(in) :: steps

    Number of optimisation iterations

    Return Value type(array_type)

    Optimised input

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function inverse_design_array_2d(this, target, x_init, optimiser, steps) result(x_opt)

    Optimise input to match a target output (array_type inputs)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    type(array_type), intent(in), dimension(:,:) :: target

    Target output values

    type(array_type), intent(in), dimension(:,:) :: x_init

    Initial input values

    class(base_optimiser_type), intent(in), optional :: optimiser

    Optimiser for input updates (defaults to network optimiser)

    integer, intent(in) :: steps

    Number of optimisation iterations

    Return Value type(array_type), dimension(size(x_init,1), size(x_init,2))

    Optimised input

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function inverse_design_real(this, target, x_init, optimiser, steps) result(x_opt)

    Optimise input to match a target output (real inputs)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of the network

    real(kind=real32), intent(in), dimension(:,:) :: target

    Target output values

    real(kind=real32), intent(in), dimension(:,:) :: x_init

    Initial input values

    class(base_optimiser_type), intent(in), optional :: optimiser

    Optimiser for input updates (defaults to network optimiser)

    integer, intent(in) :: steps

    Number of optimisation iterations

    Return Value real(kind=real32), dimension(size(x_init,1), size(x_init,2))

    Optimised input

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function layer_from_id(this, id) result(layer)

    Get the layer of the network from its ID

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in), target :: this

    Instance of the network

    integer, intent(in) :: id

    Layer ID

    Return Value class(base_layer_type), pointer

    Layer pointer

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function loss_eval(this, start_index, end_index) result(loss)

    Get the loss for the output

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout), target :: this

    Instance of network

    integer, intent(in) :: start_index

    Start and end batch indices

    integer, intent(in) :: end_index

    Start and end batch indices

    Return Value type(array_type), pointer

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine network_copy(this, source)

    Copy a network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    type(network_type), intent(in), target :: source

    Source network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine network_reduction(this, source)

    Reduce two networks down to one (i.e. add two networks - parallel)

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    type(network_type), intent(in) :: source

    Source network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine nullify_graph(this)

    Nullify graph data in the network to free memory

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine post_epoch_hook(this, epoch, loss, accuracy)

    Hook called after each training epoch. The default implementation is a no-op; override in a derived type to add custom per-epoch behaviour (e.g. W&B metric logging).

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    integer, intent(in) :: epoch

    Current epoch number (1-based)

    real(kind=real32), intent(in) :: loss

    Current loss value

    real(kind=real32), intent(in) :: accuracy

    Current accuracy value

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_array(this, input, verbose) result(output)

    Predict the output for a generic input

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of network

    class(array_type), intent(in), dimension(..) :: input

    Input graph

    integer, intent(in), optional :: verbose

    Verbosity level

    Return Value type(array_type), dimension(:,:), allocatable

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_array_from_real(this, input, output_as_array, verbose) result(output)

    Get predicted results as array from supplied inputs using the trained network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(*), intent(in), dimension(..) :: input

    Input data

    logical, intent(in) :: output_as_array

    Whether to output as array

    integer, intent(in), optional :: verbose

    Verbosity level

    Return Value type(array_type), dimension(:,:), allocatable

    Predicted output data as array

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_generic(this, input, verbose, output_as_graph) result(output)

    Predict the output for a generic input

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of network

    class(*), intent(in), dimension(:,:) :: input

    Input graph

    integer, intent(in), optional :: verbose

    Verbosity level

    logical, intent(in), optional :: output_as_graph

    Boolean whether to output as graph

    Return Value class(*), dimension(:,:), allocatable

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_graph1d(this, input, verbose) result(output)

    Get predicted results from supplied inputs using the trained network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    type(graph_type), intent(in), dimension(:) :: input

    Input data

    integer, intent(in), optional :: verbose

    Verbosity level

    Return Value type(graph_type), dimension(size(this%leaf_vertices),size(input))

    Predicted output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_graph2d(this, input, verbose) result(output)

    Get predicted results from supplied inputs using the trained network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    type(graph_type), intent(in), dimension(:,:) :: input

    Input data

    integer, intent(in), optional :: verbose

    Verbosity level

    Return Value type(graph_type), dimension(size(this%leaf_vertices),size(input, 2))

    Predicted output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function predict_real(this, input, verbose) result(output)

    Get predicted results from supplied inputs using the trained network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    real(kind=real32), intent(in), dimension(..) :: input

    Input data

    integer, intent(in), optional :: verbose

    Verbosity level

    Return Value real(kind=real32), dimension(:,:), allocatable

    Predicted output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine print(this, file)

    Print the network to file

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

    character(len=*), intent(in) :: file

    File name

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine print_summary(this)

    Print a summary of the network architecture

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(in) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine read(this, file)

    Read the network from a file

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    character(len=*), intent(in) :: file

    File name

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine read_network_settings(this, unit)

    Read network settings from a file

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    integer, intent(in) :: unit

    Unit number for input

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine read_optimiser_settings(this, unit)

    Read optimiser settings from a file

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    integer, intent(in) :: unit

    Unit number for input

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine reset(this)

    Reset the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine reset_gradients(this)

    Reset learnable parameter gradients

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine reset_state(this)

    Reset hidden state of recurrent layers

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine restore_mode(this, mode_store)

    Restore the training/inference mode of layers to the values stored in mode_store. This is used after temporarily switching modes for prediction or evaluation on a training batch.

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    logical, intent(in), dimension(:) :: mode_store

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module function save_input_to_network(this, input) result(num_samples)

    Convert and save polymorphic input to array or graph

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of network

    class(*), intent(in), dimension(..) :: input

    Input

    Return Value integer

    Number of samples

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine save_output_to_network(this, output)

    Convert and save polymorphic output to array or graph

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of network

    class(*), intent(in), dimension(:,:) :: output

    Output

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_accuracy(this, accuracy_method, verbose)

    Set network accuracy method

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    character(len=*), intent(in) :: accuracy_method

    Accuracy method

    integer, intent(in), optional :: verbose

    Verbosity level

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_batch_size(this, batch_size)

    Set batch size

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    integer, intent(in) :: batch_size

    Batch size

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_gradients(this, gradients)

    Set learnable parameter gradients

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    real(kind=real32), intent(in), dimension(..) :: gradients

    Gradients

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_inference_mode(this, mode_store, layer_indices)

    Put the network in inference mode. Layers such as dropout and batch normalisation use their inference behaviour after this call.

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    logical, intent(out), optional, dimension(:), allocatable :: mode_store

    Optional array to store the training mode of each layer

    integer, intent(in), optional, dimension(:) :: layer_indices

    Optional array of layer indices to set to inference mode.

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_loss(this, loss_method, verbose)

    Set network loss method

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(*), intent(in) :: loss_method

    Loss method

    integer, intent(in), optional :: verbose

    Verbosity level

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_metrics(this, metrics)

    Set network metrics

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(*), intent(in), dimension(..) :: metrics

    Metrics

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_params(this, params)

    Set learnable parameters

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    real(kind=real32), intent(in), dimension(this%num_params) :: params

    Learnable parameters

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine set_training_mode(this, mode_store, layer_indices)

    Put the network in training mode. Layers such as dropout and batch normalisation use their training behaviour after this call.

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    logical, intent(out), optional, dimension(:), allocatable :: mode_store

    Optional array to store the training mode of each layer

    integer, intent(in), optional, dimension(:) :: layer_indices

    Optional array of layer indices to set to training mode.

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine test(this, input, output, verbose)

    Test the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(*), intent(in), dimension(..) :: input

    Input data

    class(*), intent(in), dimension(:,:) :: output

    Expected output data (data labels)

    integer, intent(in), optional :: verbose

    Verbosity level

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine train(this, input, output, num_epochs, batch_size, plateau_threshold, shuffle_batches, batch_print_step, verbose, print_precision, scientific_print, early_stopping, val_input, val_output)

    Train the network

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network

    class(*), intent(in), dimension(..) :: input

    Input data

    class(*), intent(in), dimension(:,:) :: output

    Expected output data (data labels)

    integer, intent(in) :: num_epochs

    Number of epochs to train for

    integer, intent(in), optional :: batch_size

    Batch size (DEPRECATED)

    real(kind=real32), intent(in), optional :: plateau_threshold

    Threshold for checking learning plateau

    logical, intent(in), optional :: shuffle_batches

    Shuffle batch order

    integer, intent(in), optional :: batch_print_step

    Print step for batch

    integer, intent(in), optional :: verbose

    Verbosity level

    integer, intent(in), optional :: print_precision

    Number of decimal places to print for training metrics

    logical, intent(in), optional :: scientific_print

    Whether to print training metrics in scientific notation

    logical, intent(in), optional :: early_stopping

    Whether to stop training early if learning plateau is detected

    class(*), intent(in), optional, dimension(..) :: val_input

    Validation input data

    class(*), intent(in), optional, dimension(:,:) :: val_output

    Validation expected output data

interface

Interface for printing the network to file Interface for printing a summary of the network Interface for reading the network from a file Interface for reading network settings from a file Interface for reading optimiser settings from a file Interface for building network from ONNX nodes and initialisers Interface for adding a layer to the network Interface for resetting the network Interface for compiling the network Interface for setting batch size Interface for setting network metrics Interface for setting network loss method Interface for setting network accuracy method Interface for resetting state of recurrent layers Interface for saving input to network Interface for saving output to network Interface for training the network Interface for testing the network Interface for returning predicted results from supplied inputs using the trained network Interface for returning predicted results from supplied inputs using the trained network (graph input) Interface for updating the learnable parameters of the network based on gradients Interface for generating vertex order Interface for depth first search Interface for calculating root vertices Interface for calculating output vertices Interface for reducing two networks down to one (i.e. add two networks - parallel) Interface for copying a network Interface for getting number of learnable parameters in the network Interface for getting learnable parameters Interface for setting learnable parameters Interface for getting gradients of learnable parameters Interface for setting learnable parameter gradients Interface for resetting learnable parameter gradients Interface for forward pass

  • private module subroutine update(this)

    Update the learnable parameters of the network based on gradients

    Arguments

    Type IntentOptional Attributes Name
    class(network_type), intent(inout) :: this

    Instance of the network


Derived Types

type, public ::  network_type

Type for defining a neural network with overloaded procedures

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: accuracy_method

Loss and accuracy method names

real(kind=real32), public :: accuracy_val

Accuracy and loss of the network

type(graph_type), public :: auto_graph

Graph structure for the network

integer, public :: batch_size = 0

Batch size

integer, public :: epoch = 0

Epoch number

type(array_type), public, dimension(:,:), allocatable :: expected_array

Expected output array for the network

integer, public, dimension(:), allocatable :: fwd_layer_id

Layer ID for each vertex in forward order

integer, public, dimension(:), allocatable :: fwd_layer_type

Layer type: 0=input, 1=merge, 2=default

integer, public, dimension(:), allocatable :: fwd_num_inputs

Number of input layers for each vertex in forward order

integer, public, dimension(:), allocatable :: fwd_parent_id

Parent layer ID for single-input vertices

procedure(compute_accuracy_function), public, nopass, pointer :: get_accuracy => null()

Pointer to accuracy function

type(array_type), public, dimension(:,:), allocatable :: input_array

Input array for the network

type(graph_type), public, dimension(:,:), allocatable :: input_graph

Input graph for the network

integer, public, dimension(:), allocatable :: leaf_vertices

Root and output vertices

class(base_loss_type), public, allocatable :: loss

Loss method for the network

character(len=:), public, allocatable :: loss_method

Loss and accuracy method names

real(kind=real32), public :: loss_val

Accuracy and loss of the network

type(metric_dict_type), public, dimension(2) :: metrics

Metrics for the network

type(container_layer_type), public, allocatable, dimension(:) :: model

Model layers

character(len=:), public, allocatable :: name

Name of the network

integer, public :: num_layers = 0

Number of layers

integer, public :: num_outputs = 0

Number of outputs

integer, public :: num_params = 0

Number of parameters

class(base_optimiser_type), public, allocatable :: optimiser

Optimiser for the network

integer, public :: param_num_segments = 0

Number of parameter segments

integer, public, dimension(:), allocatable :: param_seg_end

End offset in flat parameter array

integer, public, dimension(:), allocatable :: param_seg_layer

Layer index for each parameter segment

integer, public, dimension(:), allocatable :: param_seg_pidx

Param index within that layer for each segment

integer, public, dimension(:), allocatable :: param_seg_start

Start offset in flat parameter array

integer, public, dimension(:), allocatable :: root_vertices

Root and output vertices

logical, public :: use_graph_input = .false.

Boolean flag for graph input

logical, public :: use_graph_output = .false.

Boolean flag for graph output

integer, public, dimension(:), allocatable :: vertex_order

Order of vertices

Constructor

Interface for setting up the network (network initialisation)

private module function network_setup (layers, optimiser, loss_method, accuracy_method, metrics, batch_size)

Set up the network

Type-Bound Procedures

procedure, public, pass(this) :: accuracy_eval

Get the accuracy for the output

procedure, public, pass(this) :: add

Add a layer to the network

procedure, public, pass(this) :: build_from_onnx

Build network from ONNX nodes and initialisers

procedure, public, pass(this) :: compile

Compile the network

procedure, public, pass(this) :: copy => network_copy

Copy a network

procedure, public, pass(this) :: extract_output => extract_output_real

Extract network output as real array (only works for single output layer models)

procedure, public, pass(this) :: forward => forward_generic2d

Forward pass for generic 2D input

procedure, public, pass(this) :: forward_eval

Forward pass and return pointer to output (only works for single output layer models)

procedure, public, pass(this) :: get_gradients

Get gradients of learnable parameters

procedure, public, pass(this) :: get_num_params

Get number of learnable parameters in the network

procedure, public, pass(this) :: get_output

Get the output of the network

procedure, public, pass(this) :: get_output_shape

Get the output shape of the network

procedure, public, pass(this) :: get_params

Get learnable parameters

generic, public :: inverse_design => inverse_design_real, inverse_design_array_0d, inverse_design_array_2d

Optimise input to match a target output

procedure, public, pass(this) :: layer_from_id

Get the layer of the network from its ID

procedure, public, pass(this) :: loss_eval

Get the loss for the output

procedure, public, pass(this) :: nullify_graph

Nullify graph data in the network to free memory

procedure, public, pass(this) :: post_epoch_hook

Called after each training epoch; override in derived types for custom per-epoch callbacks (e.g. logging to Weights & Biases).

generic, public :: predict => predict_real, predict_graph1d, predict_graph2d, predict_array, predict_array_from_real

Predict function for different input types

procedure, public, pass(this) :: predict_array

Predict array type output for a generic input

procedure, public, pass(this) :: predict_array_from_real

Return predicted results as array from supplied inputs using the trained network

procedure, public, pass(this) :: predict_generic

Predict generic type output for a generic input

procedure, public, pass(this) :: predict_graph1d
procedure, public, pass(this) :: predict_graph2d

Return predicted results from supplied inputs using the trained network (graph input)

procedure, public, pass(this) :: predict_real

Return predicted results from supplied inputs using the trained network

procedure, public, pass(this) :: print

Print the network to file

procedure, public, pass(this) :: print_summary

Print a summary of the network architecture

procedure, public, pass(this) :: read

Read the network from a file

procedure, public, pass(this) :: reduce => network_reduction

Reduce two networks down to one (i.e. add two networks - parallel)

procedure, public, pass(this) :: reset

Reset the network

procedure, public, pass(this) :: reset_gradients

Reset learnable parameter gradients

procedure, public, pass(this) :: reset_state

Reset hidden state of recurrent layers

procedure, public, pass(this) :: save_input => save_input_to_network

Convert and save polymorphic input to array or graph

procedure, public, pass(this) :: save_output => save_output_to_network

Convert and save polymorphic output to array or graph

procedure, public, pass(this) :: set_accuracy

Set network accuracy method

procedure, public, pass(this) :: set_batch_size

Set batch size

procedure, public, pass(this) :: set_gradients

Set learnable parameter gradients

procedure, public, pass(this) :: set_inference_mode

Set inference mode for layers with training/inference-specific behaviour

procedure, public, pass(this) :: set_loss

Set network loss method

procedure, public, pass(this) :: set_metrics

Set network metrics

procedure, public, pass(this) :: set_params

Set learnable parameters

procedure, public, pass(this) :: set_training_mode

Set training mode for layers with training/inference-specific behaviour

procedure, public, pass(this) :: test

Test the network

procedure, public, pass(this) :: train

Train the network

procedure, public, pass(this) :: update

Update the learnable parameters of the network based on gradients

procedure, private, pass(this) :: build_leaf_vertices

Calculate output vertices

procedure, private, pass(this) :: build_root_vertices

Calculate root vertices

procedure, private, pass(this) :: build_vertex_order

Generate vertex order

procedure, private, pass(this) :: dfs

Depth first search

procedure, private, pass(this) :: inverse_design_array_0d

Inverse design with 0d array_type inputs

procedure, private, pass(this) :: inverse_design_array_2d

Inverse design with 2d array_type inputs

procedure, private, pass(this) :: inverse_design_real

Inverse design with real inputs

procedure, private, pass(this) :: read_network_settings

Read network settings from a file

procedure, private, pass(this) :: read_optimiser_settings

Read optimiser settings from a file

procedure, private, pass(this) :: restore_mode

Reset the training/inference mode of layers to the values stored in mode_store.