public:
// FOR TFLNodes
- // TODO TFLAdd
+ void visit(locoex::TFLAdd *) final;
// TODO TFLAveragePool2D
// TODO TFLConcatenation
// TODO TFLConv2D
SerializedModelData &gd;
};
-// TODO TFLAdd
+void OperationExporter::visit(locoex::TFLAdd *node)
+{
+ uint32_t op_idx = gd.registerBuiltinOpcode(tflite::BuiltinOperator_ADD);
+ std::vector<int32_t> inputs_vec{get_tensor_index(node->x()), get_tensor_index(node->y())};
+ std::vector<int32_t> outputs_vec{get_tensor_index(static_cast<loco::Node *>(node))};
+ auto inputs = builder.CreateVector(inputs_vec);
+ auto outputs = builder.CreateVector(outputs_vec);
+ auto options = CreateAddOptions(builder); // dummy option
+ auto op_offset = CreateOperator(builder, op_idx, inputs, outputs,
+ tflite::BuiltinOptions_AddOptions, options.Union());
+ gd._operators.push_back(op_offset);
+}
// TODO TFLAveragePool2D