Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseBasicIs.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9template <EBasicIsOperator Op>
10std::unique_ptr<ROperator> ParseBasicIs(RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto)
11{
12
13 std::string input_name = nodeproto.input(0);
15 throw
16 std::runtime_error("TMVA::SOFIE ONNX Parser " + IsOpTraits<Op>::Name() + " op has input tensor " + input_name +
17 " but its type is not yet registered");
18 }
19
20 // get attributes for the IsInf operator
21 int detect_negative = 1;
22 int detect_positive = 1;
23 for (int_t i = 0; i < nodeproto.attribute_size(); i++) {
24 std::string attribute_name = nodeproto.attribute(i).name();
25 if (attribute_name == "detect_negative")
26 detect_negative = nodeproto.attribute(i).i();
27 if (attribute_name == "detect_positive")
28 detect_positive = nodeproto.attribute(i).i();
29 }
30
31 if (detect_positive == 0 && detect_negative == 0)
32 throw std::runtime_error("TMVA::SOFIE ONNX Parser IsInf op has invalide attributes");
33
34
35 std::unique_ptr<ROperator> op;
36 std::string output_name = nodeproto.output(0);
37
38 if (nodeproto.attribute_size() == 0 || (detect_negative == 1 && detect_positive == 1))
40 else if (nodeproto.attribute_size() > 0) {
41 // case detect_negative or detective_positive are set
42 if (detect_negative == 0)
44 else if (detect_positive == 0)
46 } else
47 throw std::runtime_error("TMVA::SOFIE ONNX Parser " + IsOpTraits<Op>::Name() + " operator - invalid attributes");
48
49 // Register the output type (is always BOOL)
52 }
53
54 return op;
55};
56
57// Parse IsNaN
58ParserFuncSignature ParseIsNaN = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
60};
61
62// Parse IsInf
63ParserFuncSignature ParseIsInf = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
65};
66
67
68} // namespace SOFIE
69} // namespace Experimental
70} // 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)
ParserFuncSignature ParseIsNaN
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
ParserFuncSignature ParseIsInf
std::unique_ptr< ROperator > ParseBasicIs(RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto)
create variable transformations