ROOT
master
Reference Guide
Loading...
Searching...
No Matches
ParseSoftmax.cxx
Go to the documentation of this file.
1
#include "
TMVA/RModelParser_ONNX.hxx
"
2
#include "
TMVA/ROperator_Softmax.hxx
"
3
#include "onnx_proto3.pb.h"
4
5
namespace
TMVA
{
6
namespace
Experimental {
7
namespace
SOFIE {
8
9
ParserFuncSignature
ParseSoftmax
= [](
RModelParser_ONNX
&parser,
const
onnx::NodeProto &
nodeproto
) {
10
ETensorType
input_type
;
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 Softmax op has input tensor "
+
input_name
+
17
" but its type is not yet registered"
);
18
}
19
20
std::unique_ptr<ROperator>
op
;
21
std::string
output_name
=
nodeproto
.output(0);
22
23
bool
logSoftmax
= (
nodeproto
.op_type() ==
"LogSoftmax"
);
24
25
int64_t
attr_axis
= -1;
26
if
(
nodeproto
.attribute_size() == 1 &&
nodeproto
.attribute(0).name() ==
"axis"
)
27
attr_axis
=
nodeproto
.attribute(0).i();
28
29
op
.reset(
new
ROperator_Softmax
(
attr_axis
,
input_name
,
output_name
,
logSoftmax
));
30
31
32
if
(!parser.
IsRegisteredTensorType
(
output_name
)) {
33
parser.
RegisterTensorType
(
output_name
,
input_type
);
34
}
35
return
op
;
36
};
37
38
39
40
}
// namespace SOFIE
41
}
// namespace Experimental
42
}
// namespace TMVA
RModelParser_ONNX.hxx
ROperator_Softmax.hxx
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:360
ROOT::Detail::TRangeCast
Definition
TCollection.h:313
TMVA::Experimental::SOFIE::RModelParser_ONNX
Definition
RModelParser_ONNX.hxx:28
TMVA::Experimental::SOFIE::RModelParser_ONNX::IsRegisteredTensorType
bool IsRegisteredTensorType(const std::string &)
Definition
RModelParser_ONNX.cxx:286
TMVA::Experimental::SOFIE::RModelParser_ONNX::RegisterTensorType
void RegisterTensorType(const std::string &, ETensorType)
Definition
RModelParser_ONNX.cxx:281
TMVA::Experimental::SOFIE::RModelParser_ONNX::GetTensorType
ETensorType GetTensorType(const std::string &name)
Definition
RModelParser_ONNX.cxx:291
TMVA::Experimental::SOFIE::ROperator_Softmax
Definition
ROperator_Softmax.hxx:15
TMVA::Experimental::SOFIE::ETensorType
ETensorType
Definition
SOFIE_common.hxx:28
TMVA::Experimental::SOFIE::ParserFuncSignature
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
Definition
RModelParser_ONNX.hxx:23
TMVA::Experimental::SOFIE::ParseSoftmax
ParserFuncSignature ParseSoftmax
Definition
ParseSoftmax.cxx:9
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
tmva
sofie_parsers
src
ParseSoftmax.cxx
ROOTmaster - Reference Guide Generated on Thu Mar 19 2026 03:32:05 (GVA Time) using Doxygen 1.10.0