Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
ParseCast.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9ParserFuncSignature ParseCast = [](RModelParser_ONNX &parser, const onnx::NodeProto &nodeproto) {
11 auto input_name = nodeproto.input(0);
14 } else {
15 throw std::runtime_error("TMVA::SOFIE ONNX Parser Cast 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 attr_type;
21
22 for (int_t i = 0; i < nodeproto.attribute_size(); i++) {
23 std::string attribute_name = nodeproto.attribute(i).name();
24 if (attribute_name == "to")
25 attr_type = ConvertTypeToString(static_cast<ETensorType>(nodeproto.attribute(i).i()));
26 }
27
28 std::string output_name = nodeproto.output(0);
29 switch (input_type) {
34 default:
35 throw std::runtime_error("TMVA::SOFIE - Unsupported - Operator Cast does not yet support input type " +
36 std::to_string(static_cast<int>(input_type)));
37 }
38
42 }
43
44 return op;
45};
46
47} // namespace SOFIE
48} // namespace Experimental
49} // 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 ParseCast
Definition ParseCast.cxx:9
std::string ConvertTypeToString(ETensorType type)
ETensorType ConvertStringToType(std::string type)
create variable transformations