ROOT   Reference Guide
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
6namespace TMVA {
7namespace Experimental {
8
9namespace Internal {
10
11/// Compute helper
12template <typename I, typename T, typename F>
14
15template <std::size_t... N, typename T, typename F>
16class ComputeHelper<std::index_sequence<N...>, T, F> {
17 template <std::size_t Idx>
18 using AlwaysT = T;
19 F fFunc;
20
21public:
22 ComputeHelper(F &&f) : fFunc(std::forward<F>(f)) {}
23 auto operator()(AlwaysT<N>... args) -> decltype(fFunc.Compute({args...})) { return fFunc.Compute({args...}); }
24};
25
26} // namespace Internal
27
28/// Helper to pass TMVA model to RDataFrame.Define nodes
29template <std::size_t N, typename T, typename F>
31{
32 return Internal::ComputeHelper<std::make_index_sequence<N>, T, F>(std::forward<F>(f));
33}
34
35} // namespace Experimental
36} // namespace TMVA
37
38#endif // TMVA_RINFERENCEUTILS
#define f(i)
Definition: RSha256.hxx:104
#define N
TRObject operator()(const T1 &t1) const
#define F(x, y, z)
double T(double x)
Definition: ChebyshevPol.h:34
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Definition: NeuralNet.icc:546
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