ROOT
master
Reference Guide
Loading...
Searching...
No Matches
ParseScatterND.cxx
Go to the documentation of this file.
1
#include "
TMVA/RModelParser_ONNX.hxx
"
2
#include "
TMVA/ROperator_ScatterND.hxx
"
3
#include "
onnx.hxx
"
4
5
namespace
TMVA
{
6
namespace
Experimental {
7
namespace
SOFIE {
8
9
ParserFuncSignature
ParseScatterND
= [](
RModelParser_ONNX
&
parser
,
const
onnx::NodeProto
&
nodeproto
) {
10
11
if
(
nodeproto
.input_size() != 3) {
12
throw
std::runtime_error(
"TMVA::SOFIE ONNX Parser ScatterND op has invalid input size"
);
13
}
14
// data is input 0
15
for
(
int
i = 0; i < 3; i++) {
16
if
(!
parser
.IsRegisteredTensorType(
nodeproto
.input(i)))
17
throw
std::runtime_error(
"TMVA::SOFIE ONNX Parser ScatterND op has input tensor "
+
nodeproto
.input(i)
18
+
" but its type is not yet registered"
);
19
}
20
21
ETensorType
input_type
=
parser
.GetTensorType(
nodeproto
.input(0));
22
// type of update tensor (input(2)) must be the same of data tensor (input(0)
23
if
(
parser
.GetTensorType(
nodeproto
.input(2)) !=
input_type
) {
24
throw
std::runtime_error(
"TMVA::SOFIE ONNX parser ScatterND op has input tensors of different types: "
+
25
nodeproto
.input(2) +
" : "
+
ConvertTypeToString
(
parser
.GetTensorType(
nodeproto
.input(2))) +
26
" and "
+
nodeproto
.input(0) +
" : "
+
ConvertTypeToString
(
input_type
));
27
}
28
29
std::string
reduction
;
30
for
(
int
i = 0; i <
nodeproto
.attribute_size(); i++) {
31
std::string
attribute_name
=
nodeproto
.attribute(i).name();
32
if
(
attribute_name
==
"reduction"
)
33
reduction
=
nodeproto
.attribute(i).s();
34
}
35
36
std::string
output_name
=
nodeproto
.output(0);
37
38
auto
op
= std::make_unique<ROperator_ScatterND>(
nodeproto
.input(0),
nodeproto
.input(1),
nodeproto
.input(2),
39
output_name
,
reduction
);
40
41
// Infer the output type
42
if
(!
parser
.IsRegisteredTensorType(
output_name
)) {
43
parser
.RegisterTensorType(
output_name
,
input_type
);
44
}
45
46
return
op
;
47
};
48
49
50
}
// namespace SOFIE
51
}
// namespace Experimental
52
}
// namespace TMVA
RModelParser_ONNX.hxx
ROperator_ScatterND.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
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::ParserFuncSignature
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &)> ParserFuncSignature
Definition
RModelParser_ONNX.hxx:25
TMVA::Experimental::SOFIE::ParseScatterND
ParserFuncSignature ParseScatterND
Definition
ParseScatterND.cxx:9
TMVA::Experimental::SOFIE::ConvertTypeToString
std::string ConvertTypeToString(ETensorType type)
Definition
SOFIE_common.cxx:66
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
onnx.hxx
tmva
sofie_parsers
src
ParseScatterND.cxx
ROOTmaster - Reference Guide Generated on Sat Sep 5 2026 04:37:47 (GVA Time) using Doxygen 1.10.0