1/*
2 * SPDX-License-Identifier: Apache-2.0
3 */
4
5#include "onnx/common/model_helpers.h"
6#include "onnx/checker.h"
7#include "onnx/defs/schema.h"
8#include "onnx/string_utils.h"
9
10namespace ONNX_NAMESPACE {
11
12Common::Status BuildNode(
13 const std::string& name,
14 const std::string& domain,
15 const std::string& doc_string,
16 const std::string& op_type,
17 std::vector<std::string> const& inputs,
18 std::vector<std::string> const& outputs,
19 NodeProto* node) {
20 if (node == NULL) {
21 return Common::Status(Common::CHECKER, Common::INVALID_ARGUMENT, "node_proto should not be nullptr.");
22 }
23 node->set_name(name);
24 node->set_domain(domain);
25 node->set_doc_string(doc_string);
26 node->set_op_type(op_type);
27 for (auto& input : inputs) {
28 node->add_input(input);
29 }
30 for (auto& output : outputs) {
31 node->add_output(output);
32 }
33
34 return Common::Status::OK();
35}
36} // namespace ONNX_NAMESPACE
37