-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRModelParser_ONNX.hxx
56 lines (37 loc) · 1.57 KB
/
RModelParser_ONNX.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef TMVA_SOFIE_RMODELPARSER_ONNX
#define TMVA_SOFIE_RMODELPARSER_ONNX
#include "SOFIE_common.hxx"
#include "RModel.hxx"
#include "OperatorList.hxx"
#include <string>
#include <fstream>
#include <memory>
#include <ctime>
//forward delcaration
namespace onnx{
class NodeProto;
class GraphProto;
}
namespace TMVA{
namespace Experimental{
namespace SOFIE{
namespace INTERNAL{
std::unique_ptr<ROperator> make_ROperator_Transpose(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type);
std::unique_ptr<ROperator> make_ROperator_Relu(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type);
std::unique_ptr<ROperator> make_ROperator_Gemm(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type);
using factoryMethodMap = std::unordered_map<std::string, std::unique_ptr<ROperator> (*)(const onnx::NodeProto&, const onnx::GraphProto&, std::unordered_map<std::string, ETensorType>&)>;
const factoryMethodMap mapOptypeOperator = {
{"Gemm", &make_ROperator_Gemm},
{"Transpose", &make_ROperator_Transpose},
{"Relu", &make_ROperator_Relu}
};
std::unique_ptr<ROperator> make_ROperator(size_t idx, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type);
}//INTERNAL
class RModelParser_ONNX{
public:
RModel Parse(std::string filename);
};
}//SOFIE
}//Experimental
}//TMVA
#endif //TMVA_SOFIE_RMODELPARSER_ONNX