ROOT
master
Reference Guide
Loading...
Searching...
No Matches
ParseGelu.cxx
Go to the documentation of this file.
1
#include "
TMVA/RModelParser_ONNX.hxx
"
2
#include "
TMVA/ROperator_Gelu.hxx
"
3
#include "
onnx.hxx
"
4
5
namespace
TMVA
{
6
namespace
Experimental {
7
namespace
SOFIE {
8
9
ParserFuncSignature
ParseGelu
= [](
RModelParser_ONNX
&
parser
,
const
onnx::NodeProto
&
nodeproto
) {
10
ETensorType
input_type
=
ETensorType::UNDEFINED
;
11
12
auto
input_name
=
nodeproto
.input(0);
13
if
(
parser
.IsRegisteredTensorType(
input_name
)) {
14
input_type
=
parser
.GetTensorType(
input_name
);
15
}
else
{
16
throw
std::runtime_error(
"TMVA::SOFIE ONNX Parser gelu op has input tensor"
+
input_name
+
17
" but its type is not yet registered"
);
18
}
19
20
// Read optional 'approximate' attribute (default: "none")
21
std::string
approximate
=
"none"
;
22
for
(
int
i = 0; i <
nodeproto
.attribute_size(); i++) {
23
const
auto
&
attr
=
nodeproto
.attribute(i);
24
if
(
attr
.name() ==
"approximate"
) {
25
approximate
=
attr
.s();
26
}
27
}
28
29
std::string
output_name
=
nodeproto
.output(0);
30
31
auto
op
= std::make_unique<ROperator_Gelu>(
input_name
,
output_name
,
approximate
);
32
33
if
(!
parser
.IsRegisteredTensorType(
output_name
)) {
34
parser
.RegisterTensorType(
output_name
,
input_type
);
35
}
36
37
return
op
;
38
};
39
40
}
// namespace SOFIE
41
}
// namespace Experimental
42
}
// namespace TMVA
RModelParser_ONNX.hxx
ROperator_Gelu.hxx
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:359
attr
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Definition
TGWin32VirtualXProxy.cxx:166
ROOT::Detail::TRangeCast
Definition
TCollection.h:312
TMVA::Experimental::SOFIE::RModelParser_ONNX
Definition
RModelParser_ONNX.hxx:30
TMVA::Experimental::SOFIE::onnx::NodeProto
Definition
onnx.hxx:504
TMVA::Experimental::SOFIE::ETensorType
ETensorType
Definition
SOFIE_common.hxx:29
TMVA::Experimental::SOFIE::ETensorType::UNDEFINED
@ UNDEFINED
TMVA::Experimental::SOFIE::ParserFuncSignature
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
Definition
RModelParser_ONNX.hxx:25
TMVA::Experimental::SOFIE::ParseGelu
ParserFuncSignature ParseGelu
Definition
ParseGelu.cxx:9
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
onnx.hxx
tmva
sofie_parsers
src
ParseGelu.cxx
ROOTmaster - Reference Guide Generated on Sat Sep 5 2026 04:37:47 (GVA Time) using Doxygen 1.10.0