3#include "onnx_proto3.pb.h"
6namespace Experimental {
10 const onnx::NodeProto &addnode) {
14 auto input_name = matmulnode.input(0);
18 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser MatMul op has input tensor " + input_name +
19 " but its type is not yet registered");
22 if (addnode.input_size() != 2)
23 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser : cannot fuse MatMul if Add does not have 2 inputs");
26 if (matmulnode.output(0) == addnode.input(0))
27 nameBias = addnode.input(1);
28 else if (matmulnode.output(0) == addnode.input(1))
29 nameBias = addnode.input(0);
31 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser : cannot fuse MatMul and Add since have different inputs");
34 std::unique_ptr<ROperator> op;
36 float attr_alpha = 1.0;
37 float attr_beta = 1.0;
38 int_t attr_transA = 0;
39 int_t attr_transB = 0;
43 op.reset(
new ROperator_Gemm<float>(attr_alpha, attr_beta, attr_transA, attr_transB, matmulnode.input(0),
44 matmulnode.input(1), nameBias, addnode.output(0)));
47 throw std::runtime_error(
48 "TMVA::SOFIE - Unsupported - Operator for fusing MatMul and Add to Gemm does not yet support input type " +
49 std::to_string(
static_cast<int>(input_type)));
52 std::string output_name = addnode.output(0);
bool IsRegisteredTensorType(const std::string &)
void RegisterTensorType(const std::string &, ETensorType)
ETensorType GetTensorType(const std::string &name)
std::function< std::unique_ptr< ROperator >(RModelParser_ONNX &, const onnx::NodeProto &, const onnx::NodeProto &)> ParserFuseFuncSignature
ParserFuseFuncSignature ParseFuseMatMulAdd
create variable transformations