15 #include <torch/script.h> 18 #include "neml2/models/Model.h" 42 virtual void to(
const torch::TensorOptions & options)
override;
47 virtual void set_value(
bool out,
bool dout_din,
bool d2out_din2)
override;
50 std::vector<const Variable<Scalar> *>
_inputs;
std::unique_ptr< torch::jit::script::Module > _surrogate
We need to use a pointer here because forward is not const qualified.
virtual void to(const torch::TensorOptions &options) override
Override the base implementation to additionally send the model loaded from torch script to different...
static OptionSet expected_options()
virtual void request_AD() override
Evaluate a pretrained libtorch model in .pt format, such as a neural network.
Representation of a data file path.
LibtorchModel(const OptionSet &options)
virtual void set_value(bool out, bool dout_din, bool d2out_din2) override
std::vector< Variable< Scalar > * > _outputs
std::vector< const Variable< Scalar > * > _inputs
Moose::DataFileUtils::Path _file_path