Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RInferenceUtils.hxx
Go to the documentation of this file.
1#ifndef TMVA_RINFERENCEUTILS
2#define TMVA_RINFERENCEUTILS
3
4#include <utility> // std::forward, std::index_sequence
5#include <vector>
6
7namespace TMVA {
8namespace Experimental {
9
10namespace Internal {
11
12/// Compute helper
13template <typename I, typename T, typename F>
15
16template <std::size_t... N, typename T, typename F>
17class ComputeHelper<std::index_sequence<N...>, T, F> {
18 template <std::size_t Idx>
19 using AlwaysT = T;
20 F fFunc;
21
22public:
23 ComputeHelper(F &&f) : fFunc(std::forward<F>(f)) {}
24 // The inputs are explicitly wrapped in a std::vector: with the batch-inference
25 // std::span overloads of Compute() around, a braced-init-list argument would be
26 // ambiguous between the single-event vector overload and the batch span overload.
27 auto operator()(AlwaysT<N>... args) -> decltype(fFunc.Compute(std::vector<T>{args...}))
28 {
29 return fFunc.Compute(std::vector<T>{args...});
30 }
31};
32
33} // namespace Internal
34
35/// Helper to pass TMVA model to RDataFrame.Define nodes
36template <std::size_t N, typename T, typename F>
41
42} // namespace Experimental
43} // namespace TMVA
44
45#endif // TMVA_RINFERENCEUTILS
#define f(i)
Definition RSha256.hxx:104
#define N
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
auto Compute(F &&f) -> Internal::ComputeHelper< std::make_index_sequence< N >, T, F >
Helper to pass TMVA model to RDataFrame.Define nodes.
create variable transformations