Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseHardSigmoid.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9ParserFuncSignature ParseHardSigmoid = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
11
12 auto input_name = nodeproto.input(0);
15 } else {
16 throw std::runtime_error("TMVA::SOFIE ONNX Parser HardSigmoid op has input tensor" + input_name +
17 " but its type is not yet registered");
18 }
19
20 std::unique_ptr<ROperator> op;
21
22 float attr_alpha = 0.2;
23 float attr_beta = 0.5;
24
25 for (int_t i = 0; i < nodeproto.attribute_size(); i++) {
26 std::string attribute_name = nodeproto.attribute(i).name();
27 if (attribute_name == "alpha")
28 attr_alpha = nodeproto.attribute(i).f();
29 if (attribute_name == "beta")
30 attr_beta = nodeproto.attribute(i).f();
31 }
32
33 std::string output_name = nodeproto.output(0);
34 switch (input_type) {
37 break;
38 default:
39 throw std::runtime_error("TMVA::SOFIE - Unsupported - Operator HardSigmoid does not yet support input type " +
40 std::to_string(static_cast<int>(input_type)));
41 }
42
45 }
46
47 return op;
48};
49
50} // namespace SOFIE
51} // namespace Experimental
52} // 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)
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
ParserFuncSignature ParseHardSigmoid
create variable transformations