LibtorchANNSurrogate

Surrogate that evaluates a feedforward artificial neural net.

Overview

The details of a simple feedforward neural network is discussed in LibtorchArtificialNeuralNet. This class is dedicated to evaluating the following function:

(1)

which describes a neural network of layers. In this context, denotes an activation function, while and are the input and output arguments. respectively. The weight matrices () and bias vectors () are optimized by LibtorchANNTrainer and are fixed in the evaluation phase.

Example Input File Syntax

Let us consider an example where we evaluate the neural network trained here. For this, prepare another set of samples of from the same parameter space:

[Samplers]
  [test]
    type = CartesianProduct
    linear_space_items = '0 0.05 2
                          0 0.05 2
                          0 0.05 2'
  []
[]
(modules/stochastic_tools/test/tests/surrogates/libtorch_nn/evaluate.i)

Following this, we load the surrogate from a file saved by the trainer:

[Surrogates]
  [surr]
    type = LibtorchANNSurrogate
    filename = 'train_out_train.rd'
  []
[]
(modules/stochastic_tools/test/tests/surrogates/libtorch_nn/evaluate.i)

And evaluate it using a reporter which uses the samples and the surrogate to compute the approximate values of the target function at the new sample points:

[Reporters]
  [results]
    type = EvaluateSurrogate
    model = surr
    sampler = test
    execute_on = FINAL
    parallel_type = ROOT
  []
[]
(modules/stochastic_tools/test/tests/surrogates/libtorch_nn/evaluate.i)

Input Parameters

  • filenameFilename containing the trained data.

    C++ Type:FileName

    Controllable:No

    Description:Filename containing the trained data.

  • trainerThe SurrogateTrainer object. If this is specified the trainer data is automatically gathered and available in this SurrogateModel object.

    C++ Type:UserObjectName

    Controllable:No

    Description:The SurrogateTrainer object. If this is specified the trainer data is automatically gathered and available in this SurrogateModel object.

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters

Input Files