ROOT   Reference Guide
Searching...
No Matches
RInferenceUtils.hxx
Go to the documentation of this file.
1#ifndef TMVA_RINFERENCEUTILS
2#define TMVA_RINFERENCEUTILS
3
4#include "ROOT/RIntegerSequence.hxx" // std::index_sequence
5#include <utility> // std::forward
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 auto operator()(AlwaysT<N>... args) -> decltype(fFunc.Compute({args...})) { return fFunc.Compute({args...}); }
25};
26
27} // namespace Internal
28
29/// Helper to pass TMVA model to RDataFrame.Define nodes
30template <std::size_t N, typename T, typename F>
32{
33 return Internal::ComputeHelper<std::make_index_sequence<N>, T, F>(std::forward<F>(f));
34}
35
36} // namespace Experimental
37} // namespace TMVA
38
39#endif // TMVA_RINFERENCEUTILS
#define f(i)
Definition RSha256.hxx:104
#define N
TRObject operator()(const T1 &t1) const
#define F(x, y, z)
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