Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #ifdef MOOSE_LIBTORCH_ENABLED 11 : 12 : #include "DRLControlNeuralNetParameters.h" 13 : #include "LibtorchDRLControlTrainer.h" 14 : 15 : registerMooseObject("StochasticToolsApp", DRLControlNeuralNetParameters); 16 : 17 : InputParameters 18 16 : DRLControlNeuralNetParameters::validParams() 19 : { 20 16 : InputParameters params = GeneralReporter::validParams(); 21 : 22 16 : params.addClassDescription("Outputs the parameters of a LibtorchArtificialNeuralNetwork within a " 23 : "LibtorchDRLControlTrainer."); 24 : 25 32 : params.addRequiredParam<UserObjectName>("trainer_name", 26 : "The control object holding the neural network."); 27 : 28 16 : return params; 29 0 : } 30 : 31 8 : DRLControlNeuralNetParameters::DRLControlNeuralNetParameters(const InputParameters & params) 32 8 : : GeneralReporter(params), SurrogateModelInterface(this) 33 : { 34 : auto & network = 35 24 : declareValueByName<const Moose::LibtorchArtificialNeuralNet *>(name(), REPORTER_MODE_ROOT); 36 8 : network = &getSurrogateTrainer<LibtorchDRLControlTrainer>("trainer_name").controlNeuralNet(); 37 8 : } 38 : 39 : #endif