ATLAS Offline Software
Loading...
Searching...
No Matches
FastGraph.h
Go to the documentation of this file.
1// this is -*- C++ -*-
2/*
3 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4*/
5
6// Any modifications to this file may be copied to lwtnn[1] without
7// attribution.
8//
9// [1]: https::www.github.com/lwtnn/lwtnn
10
11#ifndef LWTNN_UTILS_FAST_GRAPH_H
12#define LWTNN_UTILS_FAST_GRAPH_H
13
14#include "lwtnn/lightweight_network_config.hh"
15#include "lwtnn/Graph.hh"
17#include <Eigen/Dense>
18
19namespace lwt::atlas {
20
23 struct InputOrder;
24
26 {
27 std::vector<size_t> scalar;
28 std::vector<size_t> sequence;
29 };
30
31 // Graph class
33 {
34 public:
35 // Since a graph has multiple input nodes, we actually call
36 typedef std::vector<Eigen::VectorXd> NodeVec;
37 typedef std::vector<Eigen::MatrixXd> SeqNodeVec;
38
39
40 // In cases where the graph has multiple outputs, we have to
41 // define a "default" output, so that calling "compute" with no
42 // output specified doesn't lead to ambiguity.
43 FastGraph(const GraphConfig& config, const InputOrder& order,
44 std::string default_output = "");
45
46 ~FastGraph();
47 FastGraph(FastGraph&) = delete;
49
50 // The simpler "compute" function
51 Eigen::VectorXd compute(const NodeVec&, const SeqNodeVec& = {}) const;
52
53 // the other "compute" which allows you to select an arbitrary output
54 Eigen::VectorXd compute(const NodeVec&, const SeqNodeVec&, size_t) const;
55
56 private:
59 typedef std::vector<IP*> Preprocs;
60 typedef std::vector<IVP*> VecPreprocs;
61
62 Graph* m_graph;
66 // the mapping from a node in the network to a user input node
68 };
69}
70
71#endif
std::vector< IP * > Preprocs
Definition FastGraph.h:59
FastInputPreprocessor IP
Definition FastGraph.h:57
FastGraph & operator=(FastGraph &)=delete
SourceIndices m_input_indices
Definition FastGraph.h:67
FastGraph(const GraphConfig &config, const InputOrder &order, std::string default_output="")
std::vector< IVP * > VecPreprocs
Definition FastGraph.h:60
std::vector< Eigen::MatrixXd > SeqNodeVec
Definition FastGraph.h:37
FastInputVectorPreprocessor IVP
Definition FastGraph.h:58
std::vector< Eigen::VectorXd > NodeVec
Definition FastGraph.h:36
FastGraph(FastGraph &)=delete
Eigen::VectorXd compute(const NodeVec &, const SeqNodeVec &={}) const
VecPreprocs m_vec_preprocs
Definition FastGraph.h:64
Ensure that the extensions for the Vector3D are properly loaded.
FastGraph::NodeVec NodeVec
std::vector< size_t > sequence
Definition FastGraph.h:28
std::vector< size_t > scalar
Definition FastGraph.h:27