Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParsePad.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9ParserFuncSignature ParsePad = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
11
12 std::string input_name = nodeproto.input(0);
15 } else {
16 throw std::runtime_error("TMVA::SOFIE ONNX Parser Pad op has input tensor" + input_name +
17 " but its type is not yet registered");
18 }
19
20 if (nodeproto.input_size() < 2) {
21 throw std::runtime_error("TMVA::SOFIE ONNX Parser Pad op has invalid input size < 2");
22 }
23
24 // pads is second inputs
25 std::string pads_name = nodeproto.input(1);
26 if (!parser.IsRegisteredTensorType(pads_name)) {
27 throw std::runtime_error("TMVA::SOFIE ONNX Parser Pad op has input tensor" + pads_name +
28 " but its type is not yet registered");
29 }
30 // in case of optional inputs
31 std::string cvalue_name;
32 if (nodeproto.input_size() > 2) {
33 cvalue_name = nodeproto.input(2);
34 }
35 std::string axes_name;
36 if (nodeproto.input_size() > 3) {
37 axes_name = nodeproto.input(3);
38 }
39
40 // get attributes
41 std::string mode = "constant";
42 if (nodeproto.attribute_size() > 0 ) {
43 std::string attribute_name = nodeproto.attribute(0).name();
44 if (attribute_name == "mode") {
45 mode = nodeproto.attribute(0).s();
46 }
47 }
48 std::string output_name = nodeproto.output(0);
49
50 std::unique_ptr<ROperator> op;
51 switch (input_type) {
54 break;
55 default:
56 throw std::runtime_error("TMVA::SOFIE - Unsupported - Operator Pad does not yet support input type " +
57 std::to_string(static_cast<int>(input_type)));
58 }
59
62 }
63
64 return op;
65};
66
67} // namespace SOFIE
68} // namespace Experimental
69} // namespace TMVA
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char mode
void RegisterTensorType(const std::string &, ETensorType)
ETensorType GetTensorType(const std::string &name)
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
ParserFuncSignature ParsePad
Definition ParsePad.cxx:9
create variable transformations