Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParseTanh.cxx
Go to the documentation of this file.
3#include "onnx_proto3.pb.h"
4
5namespace TMVA {
6namespace Experimental {
7namespace SOFIE {
8
9ParserFuncSignature ParseTanh = [](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 Tanh 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 switch (input_type) {
24 case ETensorType::FLOAT: op.reset(new ROperator_Tanh<float>(input_name, output_name)); break;
25 default:
26 throw std::runtime_error("TMVA::SOFIE - Unsupported - Operator Tanh does not yet support input type " +
27 std::to_string(static_cast<int>(input_type)));
28 }
29
30 if (!parser.IsRegisteredTensorType(output_name)) {
31 parser.RegisterTensorType(output_name, input_type);
32 }
33
34 return op;
35};
36
37} // namespace SOFIE
38} // namespace Experimental
39} // namespace TMVA
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 ParseTanh
Definition ParseTanh.cxx:9
create variable transformations