Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseComparision.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9template <EComparisionOperator Op>
10std::unique_ptr<ROperator> ParseComparision(RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto)
11{
13
14 for (int i = 0; i < 2; ++i) {
15 auto input_name = nodeproto.input(i);
17 // according to ONNX both inputs have same type
18 if (i == 0)
20 else
21 if (input_type != parser.GetTensorType(input_name)) {
22 throw
23 std::runtime_error("TMVA::SOFIE ONNX parser Comparision op has input tensors of different types");
24 }
25 } else {
26 throw std::runtime_error("TMVA::SOFIE ONNX Parser Comparision op has input tensor " + input_name +
27 " but its type is not yet registered");
28 }
29 }
30
31
32 std::string output_name = nodeproto.output(0);
33
34 std::unique_ptr<ROperator> op;
35 switch (input_type) {
38 break;
41 break;
44 break;
45 default:
46 throw std::runtime_error("TMVA::SOFIE - Unsupported - Comparision Operator does not yet support input type " +
48 }
49
50 // Infer the output type
53 }
54
55 return op;
56};
57
58// Parse Equal
59ParserFuncSignature ParseEq = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
61};
62
63// Parse Less
67
68// Parse Mul
72
73// Parse Div
77
78// Parse Pow
82
83} // namespace SOFIE
84} // namespace Experimental
85} // namespace TMVA
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void RegisterTensorType(const std::string &, ETensorType)
ETensorType GetTensorType(const std::string &name)
ParserFuncSignature ParseGreater
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
ParserFuncSignature ParseEq
ParserFuncSignature ParseLess
ParserFuncSignature ParseGreaterEq
std::string ConvertTypeToString(ETensorType type)
ParserFuncSignature ParseLessEq
std::unique_ptr< ROperator > ParseComparision(RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto)
create variable transformations