1 #include "caffe2/onnx/helper.h" 3 #include "caffe2/core/logging.h" 4 #include "caffe2/core/operator.h" 6 namespace caffe2 {
namespace onnx {
8 size_t DummyName::counter_ = 0;
10 std::unordered_set<std::string>& DummyName::get_used_names() {
11 static std::unordered_set<std::string> used_names;
15 std::string DummyName::NewDummyName() {
17 const std::string name = caffe2::MakeString(
"OC2_DUMMY_", counter_++);
18 auto ret = get_used_names().insert(name);
25 void DummyName::Reset(
const std::unordered_set<std::string> &used_names) {
26 auto& names = get_used_names();
32 const std::string& type,
33 const std::vector<std::string>& inputs,
34 const std::vector<std::string>& outputs,
35 const std::vector<AttributeProto>& attributes,
36 const std::string& name) {
41 node.set_op_type(type);
42 for (
const auto& input: inputs) {
43 node.add_input(input);
45 for (
const auto& output: outputs) {
46 node.add_output(output);
48 for (
const auto& attr: attributes) {
49 node.add_attribute()->CopyFrom(attr);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...