3 #include "onnx/onnx_pb.h" 7 #include <unordered_set> 12 using ::ONNX_NAMESPACE::AttributeProto;
13 using ::ONNX_NAMESPACE::NodeProto;
18 static std::string NewDummyName();
20 static void Reset(
const std::unordered_set<std::string>& used_names);
22 static void AddName(
const std::string& new_used) {
23 get_used_names().insert(new_used);
27 static std::unordered_set<std::string>& get_used_names();
28 static size_t counter_;
31 inline AttributeProto MakeAttribute(
32 const std::string& name,
33 const std::vector<int64_t>& vals) {
36 for (
const auto v : vals) {
39 attr.set_type(AttributeProto::INTS);
43 inline AttributeProto MakeAttribute(
const std::string& name, int64_t val) {
47 attr.set_type(AttributeProto::INT);
51 inline AttributeProto MakeAttribute(
52 const std::string& name,
53 const std::string& val) {
57 attr.set_type(AttributeProto::STRING);
62 const std::string& type,
63 const std::vector<std::string>& inputs,
64 const std::vector<std::string>& outputs,
65 const std::vector<AttributeProto>& attributes,
66 const std::string& name =
"");
68 inline NodeProto MakeNode(
69 const std::string& type,
70 const std::vector<std::string>& inputs,
71 const std::vector<std::string>& outputs,
72 const std::string& name =
"") {
73 return MakeNode(type, inputs, outputs, {}, name);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...