Skip to content

Commit 1ceb51e

Browse files
committed
[tmva][sofie] Various improvements in ONNX parser
Include contributions from Neel Shah and Sanjiban Segupta - add support for Softmax, Identity and Concat operators - Add support for fusing Matmul and Add in a single Gemm operator - Re-order correctly using the topological input order the nodes of the ONNX graph. It has been found parsing some models , like the one of CMS, that the order in the file was not correct - Add support for passing to the model the correct order of input names
1 parent 52343be commit 1ceb51e

File tree

2 files changed

+344
-64
lines changed

2 files changed

+344
-64
lines changed

tmva/sofie_parsers/inc/TMVA/RModelParser_ONNX.hxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ std::unique_ptr<ROperator> make_ROperator_GemmFromMatMulandAdd(const onnx::NodeP
3939
std::unique_ptr<ROperator> make_ROperator_Reshape(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type);
4040
std::unique_ptr<ROperator> make_ROperator_Slice(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type);
4141
std::unique_ptr<ROperator> make_ROperator_GRU(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type);
42-
42+
std::unique_ptr<ROperator> make_ROperator_Identity(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type);
43+
std::unique_ptr<ROperator> make_ROperator_Softmax(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type);
44+
std::unique_ptr<ROperator> make_ROperator_Concat(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type);
4345

4446
using factoryMethodMap = std::unordered_map<std::string, std::unique_ptr<ROperator> (*)(const onnx::NodeProto&, const onnx::GraphProto&, std::unordered_map<std::string, ETensorType>&)>;
4547
const factoryMethodMap mapOptypeOperator = {
@@ -62,7 +64,10 @@ const factoryMethodMap mapOptypeOperator = {
6264
{"Slice", &make_ROperator_Slice},
6365
{"Squeeze", &make_ROperator_Reshape},
6466
{"Unsqueeze", &make_ROperator_Reshape},
65-
{"Flatten", &make_ROperator_Reshape}
67+
{"Flatten", &make_ROperator_Reshape},
68+
{"Identity", &make_ROperator_Identity},
69+
{"Softmax", &make_ROperator_Softmax},
70+
{"Concat", &make_ROperator_Concat}
6671
};
6772

6873
using factoryMethodMap1 = std::unordered_map<std::string, std::unique_ptr<ROperator> (*)(const onnx::NodeProto&,const onnx::NodeProto&, const onnx::GraphProto&, std::unordered_map<std::string, ETensorType>&)>;
@@ -76,7 +81,7 @@ std::unique_ptr<ROperator> make_ROperator(size_t idx, const onnx::GraphProto& gr
7681

7782
class RModelParser_ONNX{
7883
public:
79-
RModel Parse(std::string filename);
84+
RModel Parse(std::string filename, bool verbose = false);
8085
};
8186

8287

0 commit comments

Comments
 (0)