ROOT
v6-32
Reference Guide
Loading...
Searching...
No Matches
ParseShape.cxx
Go to the documentation of this file.
1
#include "
TMVA/RModelParser_ONNX.hxx
"
2
#include "
TMVA/ROperator_Shape.hxx
"
3
#include "onnx_proto3.pb.h"
4
5
namespace
TMVA
{
6
namespace
Experimental {
7
namespace
SOFIE {
8
9
ParserFuncSignature
ParseShape
= [](
RModelParser_ONNX
&parser,
const
onnx::NodeProto &
nodeproto
) {
10
ETensorType
input_type
=
ETensorType::UNDEFINED
;
11
auto
input_name
=
nodeproto
.input(0);
12
if
(parser.
IsRegisteredTensorType
(
input_name
)) {
13
input_type
= parser.
GetTensorType
(
input_name
);
14
}
else
{
15
throw
std::runtime_error(
"TMVA::SOFIE ONNX Parser Shape op has input tensor"
+
input_name
+
16
" but its type is not yet registered"
);
17
}
18
19
std::unique_ptr<ROperator>
op
;
20
std::string
output_name
=
nodeproto
.output(0);
21
int
attr_start
= 0;
22
int
attr_end
= -1;
23
24
for
(
int_t
i = 0; i <
nodeproto
.attribute_size(); i++) {
25
std::string
attribute_name
=
nodeproto
.attribute(i).name();
26
if
(
attribute_name
==
"start"
)
27
attr_start
=
nodeproto
.attribute(i).i();
28
if
(
attribute_name
==
"end"
)
29
attr_end
=
nodeproto
.attribute(i).i();
30
}
31
32
op
.reset(
new
ROperator_Shape
(
attr_start
,
attr_end
,
input_name
,
output_name
));
33
34
if
(!parser.
IsRegisteredTensorType
(
output_name
)) {
35
parser.
RegisterTensorType
(
output_name
,
input_type
);
36
}
37
38
return
op
;
39
};
40
41
}
// namespace SOFIE
42
}
// namespace Experimental
43
}
// namespace TMVA
RModelParser_ONNX.hxx
ROperator_Shape.hxx
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TMVA::Experimental::SOFIE::RModelParser_ONNX
Definition
RModelParser_ONNX.hxx:27
TMVA::Experimental::SOFIE::RModelParser_ONNX::IsRegisteredTensorType
bool IsRegisteredTensorType(const std::string &)
Definition
RModelParser_ONNX.cxx:184
TMVA::Experimental::SOFIE::RModelParser_ONNX::RegisterTensorType
void RegisterTensorType(const std::string &, ETensorType)
Definition
RModelParser_ONNX.cxx:179
TMVA::Experimental::SOFIE::RModelParser_ONNX::GetTensorType
ETensorType GetTensorType(const std::string &name)
Definition
RModelParser_ONNX.cxx:189
TMVA::Experimental::SOFIE::ROperator_Shape
Definition
ROperator_Shape.hxx:18
TMVA::Experimental::SOFIE::ETensorType
ETensorType
Definition
SOFIE_common.hxx:25
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:22
TMVA::Experimental::SOFIE::ParseShape
ParserFuncSignature ParseShape
Definition
ParseShape.cxx:9
TMVA::Experimental::SOFIE::int_t
std::int64_t int_t
Definition
SOFIE_common.hxx:30
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
tmva
sofie_parsers
src
ParseShape.cxx
ROOT v6-32 - Reference Guide Generated on Wed Sep 10 2025 04:28:21 (GVA Time) using Doxygen 1.10.0