Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseInstanceNormalization.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
10 const onnx::NodeProto &nodeproto) -> std::unique_ptr<ROperator> {
12 const std::string input_name = nodeproto.input(0);
15 } else {
16 throw std::runtime_error("TMVA::SOFIE ONNX Parser InstanceNormalization op has input tensor " + input_name +
17 " but its type is not yet registered");
18 }
19
20 float epsilon = 1e-5;
21 for (int64_t i = 0; i < nodeproto.attribute_size(); i++) {
22 if (nodeproto.attribute(i).name() == "epsilon") {
23 epsilon = nodeproto.attribute(i).f();
24 }
25 }
26
27 // Inputs: X (0), scale (1), B (2)
28 const std::string name_scale = nodeproto.input(1);
29 const std::string name_bias = nodeproto.input(2);
30 const std::string output_name = nodeproto.output(0);
31
32 std::unique_ptr<ROperator> op;
33 switch (input_type) {
36 break;
37 default:
38 throw std::runtime_error("TMVA::SOFIE ONNX parser Operator with input type " + ConvertTypeToString(input_type) +
39 " not supported.");
40 break;
41 }
42
45 }
46
47 return op;
48};
49
50} // namespace SOFIE
51} // namespace Experimental
52} // namespace TMVA
#define e(i)
Definition RSha256.hxx:103
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
std::string ConvertTypeToString(ETensorType type)
ParserFuncSignature ParseInstanceNormalization
create variable transformations