LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArDLHelper.h
Go to the documentation of this file.
1 
8 #ifndef LAR_DL_HELPER_H
9 #define LAR_DL_HELPER_H 1
10 
11 #include <torch/script.h>
12 #include <torch/torch.h>
13 
14 #include "Pandora/StatusCodes.h"
15 
16 namespace lar_dl_content
17 {
18 
23 {
24 public:
25  typedef torch::jit::script::Module TorchModel;
26  typedef torch::Tensor TorchInput;
27  typedef std::vector<torch::jit::IValue> TorchInputVector;
28  typedef at::Tensor TorchOutput;
29 
38  static pandora::StatusCode LoadModel(const std::string &filename, TorchModel &model);
39 
46  static void InitialiseInput(const at::IntArrayRef dimensions, TorchInput &tensor);
47 
55  static void Forward(TorchModel &model, const TorchInputVector &input, TorchOutput &output);
56 };
57 
58 } // namespace lar_dl_content
59 
60 #endif // #ifndef LAR_DL_HELPER_H
torch::jit::script::Module TorchModel
Definition: LArDLHelper.h:25
static void Forward(TorchModel &model, const TorchInputVector &input, TorchOutput &output)
Run a deep learning model.
Definition: LArDLHelper.cc:41
LArDLHelper class.
Definition: LArDLHelper.h:22
static pandora::StatusCode LoadModel(const std::string &filename, TorchModel &model)
Loads a deep learning model.
Definition: LArDLHelper.cc:16
static void InitialiseInput(const at::IntArrayRef dimensions, TorchInput &tensor)
Create a torch input tensor.
Definition: LArDLHelper.cc:34
std::vector< torch::jit::IValue > TorchInputVector
Definition: LArDLHelper.h:27