From 1a6ede41b39bfd99d02aaa03092bec9977c3fece Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=91=D0=B0=D1=80?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2/AI=20Tools=20Lab=20/S?= =?utf8?q?RR/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 5 Aug 2019 19:43:06 +0300 Subject: [PATCH] [mir_caffe2] Rename namespace nnc to mir_caffe2 in Caffe2 importer (#6238) * Rename namespace and include guards in Caffe2 importer * Fix usages of the namespace in `nnc` Signed-off-by: Sergei Barannikov --- compiler/mir-caffe2-importer/caffe2_importer.cpp | 4 ++-- compiler/mir-caffe2-importer/caffe2_importer.h | 10 +++++----- compiler/mir-caffe2-importer/caffe2_op_creator.cpp | 4 ++-- compiler/mir-caffe2-importer/caffe2_op_creator.h | 10 +++++----- compiler/mir-caffe2-importer/caffe2_op_types.h | 10 +++++----- compiler/mir-caffe2-importer/caffe2_proto_helper.cpp | 4 ++-- compiler/mir-caffe2-importer/caffe2_proto_helper.h | 10 +++++----- compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.cpp | 2 +- compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.h | 8 ++++++-- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/compiler/mir-caffe2-importer/caffe2_importer.cpp b/compiler/mir-caffe2-importer/caffe2_importer.cpp index 1d09a9e..2d95146 100644 --- a/compiler/mir-caffe2-importer/caffe2_importer.cpp +++ b/compiler/mir-caffe2-importer/caffe2_importer.cpp @@ -34,7 +34,7 @@ #include #include -namespace nnc +namespace mir_caffe2 { using namespace ::caffe2; @@ -257,4 +257,4 @@ const std::map Caffe2Importer::_operatorType {"GivenTensorInt64Fill", SupportedCaffe2OpType::givenTensorInt64Fill}, }; -} // namespace nnc +} // namespace mir_caffe2 diff --git a/compiler/mir-caffe2-importer/caffe2_importer.h b/compiler/mir-caffe2-importer/caffe2_importer.h index cd7ad6e..782462d 100644 --- a/compiler/mir-caffe2-importer/caffe2_importer.h +++ b/compiler/mir-caffe2-importer/caffe2_importer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef NNCC_CAFFE2_IMPORTER_H -#define NNCC_CAFFE2_IMPORTER_H +#ifndef MIR_CAFFE2_IMPORTER_H +#define MIR_CAFFE2_IMPORTER_H #include #include @@ -25,7 +25,7 @@ #include "caffe2_op_creator.h" #include "caffe2_op_types.h" -namespace nnc +namespace mir_caffe2 { class Caffe2Importer @@ -79,6 +79,6 @@ private: void setGraphOutputs(); }; -} // namespace nnc +} // namespace mir_caffe2 -#endif // NNCC_CAFFE2_IMPORTER_H +#endif // MIR_CAFFE2_IMPORTER_H diff --git a/compiler/mir-caffe2-importer/caffe2_op_creator.cpp b/compiler/mir-caffe2-importer/caffe2_op_creator.cpp index 038f746..3851796 100644 --- a/compiler/mir-caffe2-importer/caffe2_op_creator.cpp +++ b/compiler/mir-caffe2-importer/caffe2_op_creator.cpp @@ -46,7 +46,7 @@ #include #include -namespace nnc +namespace mir_caffe2 { static mir::TensorVariant fixGroupedKernel(int groups, const mir::TensorVariant &folded_kernel) @@ -655,4 +655,4 @@ Operation::Output *Caffe2OpCreator::createInput(const std::string &name, const m return _graph->create(name, shape)->getOutput(0); } -} // namespace nnc +} // namespace mir_caffe2 diff --git a/compiler/mir-caffe2-importer/caffe2_op_creator.h b/compiler/mir-caffe2-importer/caffe2_op_creator.h index 675e9a0..41cda23 100644 --- a/compiler/mir-caffe2-importer/caffe2_op_creator.h +++ b/compiler/mir-caffe2-importer/caffe2_op_creator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef NNCC_CAFFE2_OP_CREATOR_H -#define NNCC_CAFFE2_OP_CREATOR_H +#ifndef MIR_CAFFE2_OP_CREATOR_H +#define MIR_CAFFE2_OP_CREATOR_H #include #include @@ -30,7 +30,7 @@ #include "caffe2/proto/caffe2.pb.h" -namespace nnc +namespace mir_caffe2 { using mir::Operation; @@ -123,6 +123,6 @@ mir::Operation *Caffe2OpCreator::createOp(const std::string &name, Types &&... a return new_op; } -} // namespace nnc +} // namespace mir_caffe2 -#endif // NNCC_CAFFE2_OP_CREATOR_H +#endif // MIR_CAFFE2_OP_CREATOR_H diff --git a/compiler/mir-caffe2-importer/caffe2_op_types.h b/compiler/mir-caffe2-importer/caffe2_op_types.h index 035aea1..b5e7e76 100644 --- a/compiler/mir-caffe2-importer/caffe2_op_types.h +++ b/compiler/mir-caffe2-importer/caffe2_op_types.h @@ -14,10 +14,10 @@ * limitations under the License. */ -#ifndef NNCC_CAFFE2_OP_TYPES_H -#define NNCC_CAFFE2_OP_TYPES_H +#ifndef MIR_CAFFE2_OP_TYPES_H +#define MIR_CAFFE2_OP_TYPES_H -namespace nnc +namespace mir_caffe2 { enum class SupportedCaffe2OpType @@ -43,6 +43,6 @@ enum class SupportedCaffe2OpType sum, }; -} // namespace nnc +} // namespace mir_caffe2 -#endif // NNCC_CAFFE2_OP_TYPES_H +#endif // MIR_CAFFE2_OP_TYPES_H diff --git a/compiler/mir-caffe2-importer/caffe2_proto_helper.cpp b/compiler/mir-caffe2-importer/caffe2_proto_helper.cpp index d47a254..a7cde64 100644 --- a/compiler/mir-caffe2-importer/caffe2_proto_helper.cpp +++ b/compiler/mir-caffe2-importer/caffe2_proto_helper.cpp @@ -16,7 +16,7 @@ #include "caffe2_proto_helper.h" -namespace nnc +namespace mir_caffe2 { const ::caffe2::Argument &findArgumentByName(RepArgument args, const std::string &name) @@ -59,4 +59,4 @@ std::string getSingleArgument(const ::caffe2::OperatorDef &op, const std::string return default_value; } -} // namespace nnc +} // namespace mir_caffe2 diff --git a/compiler/mir-caffe2-importer/caffe2_proto_helper.h b/compiler/mir-caffe2-importer/caffe2_proto_helper.h index 46e3580..4c47ede 100644 --- a/compiler/mir-caffe2-importer/caffe2_proto_helper.h +++ b/compiler/mir-caffe2-importer/caffe2_proto_helper.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef NNCC_CAFFE2_PROTO_HELPER_H -#define NNCC_CAFFE2_PROTO_HELPER_H +#ifndef MIR_CAFFE2_PROTO_HELPER_H +#define MIR_CAFFE2_PROTO_HELPER_H #include "caffe2/proto/caffe2.pb.h" -namespace nnc +namespace mir_caffe2 { using RepArgument = const ::google::protobuf::RepeatedPtrField<::caffe2::Argument> &; @@ -35,6 +35,6 @@ float getSingleArgument(const ::caffe2::OperatorDef &op, const std::string &argu std::string getSingleArgument(const ::caffe2::OperatorDef &op, const std::string &argument_name, const std::string &default_value); -} // namespace nnc +} // namespace mir_caffe2 -#endif // NNCC_CAFFE2_PROTO_HELPER_H +#endif // MIR_CAFFE2_PROTO_HELPER_H diff --git a/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.cpp b/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.cpp index 03701d2..4230fbe 100644 --- a/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.cpp +++ b/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.cpp @@ -22,7 +22,7 @@ namespace nnc Caffe2ImporterPass::Caffe2ImporterPass(const std::string &predict_net, const std::string &init_net, const std::vector> &input_shapes) - : _pimpl(new Caffe2Importer(predict_net, init_net, input_shapes)) + : _pimpl(new mir_caffe2::Caffe2Importer(predict_net, init_net, input_shapes)) { } diff --git a/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.h b/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.h index ec59bcf..776d2d6 100644 --- a/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.h +++ b/compiler/nnc/passes/caffe2_frontend/caffe2_importer_pass.h @@ -22,10 +22,14 @@ #include #include +namespace mir_caffe2 +{ +class Caffe2Importer; +} // namespace mir_caffe2 + namespace nnc { -class Caffe2Importer; class Caffe2ImporterPass : public NNImporter { public: @@ -39,7 +43,7 @@ public: ~Caffe2ImporterPass() override; private: - std::unique_ptr _pimpl; + std::unique_ptr _pimpl; std::unique_ptr _graph; }; -- 2.7.4