Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseScatterND.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9ParserFuncSignature 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
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),
40
41 // Infer the output type
44 }
45
46 return op;
47};
48
49
50} // namespace SOFIE
51} // namespace Experimental
52} // namespace TMVA
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
ParserFuncSignature ParseScatterND
std::string ConvertTypeToString(ETensorType type)
create variable transformations