From 6e5e19a01a699bc8f336924b7b70b7337580131d Mon Sep 17 00:00:00 2001
From: =?utf8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=98=D0=BB=D1=8C=D1=8E?=
=?utf8?q?=D1=82=D1=87=D0=B5=D0=BD=D0=BA=D0=BE/AI=20Tools=20Lab=20/SRR/Eng?=
=?utf8?q?ineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?=
Date: Mon, 5 Aug 2019 18:39:48 +0300
Subject: [PATCH] Rename ncc namespace into mir_onnx in ONNX importer (#6236)
* Rename namespace in importer
* Fix onnx_frontend in NNC
Signed-off-by: Pavel Iliutchenko
---
compiler/mir-onnx-importer/ONNXImporterImpl.cpp | 4 ++--
compiler/mir-onnx-importer/ONNXImporterImpl.h | 10 +++++-----
compiler/mir-onnx-importer/ONNXOpCreator.cpp | 4 ++--
compiler/mir-onnx-importer/ONNXOpCreator.h | 10 +++++-----
compiler/mir-onnx-importer/ONNXOpType.h | 10 +++++-----
compiler/mir-onnx-importer/ONNXPerfect.gperf | 2 +-
compiler/mir-onnx-importer/ONNXPerfectHash.h | 4 ++--
compiler/nnc/passes/onnx_frontend/ONNXImporterPass.cpp | 2 +-
compiler/nnc/passes/onnx_frontend/ONNXImporterPass.h | 9 ++++++---
9 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/compiler/mir-onnx-importer/ONNXImporterImpl.cpp b/compiler/mir-onnx-importer/ONNXImporterImpl.cpp
index d3d7f0a..41eaea2 100644
--- a/compiler/mir-onnx-importer/ONNXImporterImpl.cpp
+++ b/compiler/mir-onnx-importer/ONNXImporterImpl.cpp
@@ -42,7 +42,7 @@
#include
#include
-namespace nnc
+namespace mir_onnx
{
ONNXImporterImpl::ONNXImporterImpl(std::string filename) : _modelFilename(std::move(filename))
@@ -362,4 +362,4 @@ std::unique_ptr ONNXImporterImpl::importModel()
return createIR();
}
-} // namespace nnc
+} // namespace mir_onnx
diff --git a/compiler/mir-onnx-importer/ONNXImporterImpl.h b/compiler/mir-onnx-importer/ONNXImporterImpl.h
index f8944a0..6e352dd 100644
--- a/compiler/mir-onnx-importer/ONNXImporterImpl.h
+++ b/compiler/mir-onnx-importer/ONNXImporterImpl.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef NNCC_ONNX_IMPORTER_H
-#define NNCC_ONNX_IMPORTER_H
+#ifndef _MIR_ONNX_IMPORTER_H
+#define _MIR_ONNX_IMPORTER_H
#include "ONNXOpCreator.h"
#include "ONNXOpType.h"
@@ -25,7 +25,7 @@
#include
#include
-namespace nnc
+namespace mir_onnx
{
class ONNXImporterImpl
@@ -54,6 +54,6 @@ private:
std::unique_ptr _graph;
ONNXOpCreator _opCreator;
};
-} // namespace nnc
+} // namespace mir_onnx
-#endif // NNCC_ONNX_IMPORTER_H
+#endif // _MIR_ONNX_IMPORTER_H
diff --git a/compiler/mir-onnx-importer/ONNXOpCreator.cpp b/compiler/mir-onnx-importer/ONNXOpCreator.cpp
index d1a4005..b4a497e 100644
--- a/compiler/mir-onnx-importer/ONNXOpCreator.cpp
+++ b/compiler/mir-onnx-importer/ONNXOpCreator.cpp
@@ -50,7 +50,7 @@
#include
#include
-namespace nnc
+namespace mir_onnx
{
static mir::TensorVariant fixGroupedKernel(int groups, const mir::TensorVariant &folded_kernel)
@@ -658,4 +658,4 @@ mir::Operation::Output *ONNXOpCreator::convertMIRToONNX(mir::Operation::Output *
// NHWC -> NCHW
return createOp(arg, std::vector{0, 3, 1, 2})->getOutput(0);
}
-} // namespace nnc
+} // namespace mir_onnx
diff --git a/compiler/mir-onnx-importer/ONNXOpCreator.h b/compiler/mir-onnx-importer/ONNXOpCreator.h
index 8fccf5c..1bee16c 100644
--- a/compiler/mir-onnx-importer/ONNXOpCreator.h
+++ b/compiler/mir-onnx-importer/ONNXOpCreator.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef NNCC_ONNX_OP_CREATOR_H
-#define NNCC_ONNX_OP_CREATOR_H
+#ifndef _MIR_ONNX_OP_CREATOR_H
+#define _MIR_ONNX_OP_CREATOR_H
#include "onnx/onnx.pb.h"
#include "ONNXOpType.h"
@@ -31,7 +31,7 @@
#include
#include
-namespace nnc
+namespace mir_onnx
{
class ONNXOpCreator
@@ -126,5 +126,5 @@ mir::Operation *ONNXOpCreator::createOp(Types &&... args)
// TODO: set operation names
return _graph->create("", std::forward(args)...);
}
-} // namespace nnc
-#endif // NNCC_ONNX_OP_CREATOR_H
+} // namespace mir_onnx
+#endif // _MIR_ONNX_OP_CREATOR_H
diff --git a/compiler/mir-onnx-importer/ONNXOpType.h b/compiler/mir-onnx-importer/ONNXOpType.h
index 3466144..a63f9a5 100644
--- a/compiler/mir-onnx-importer/ONNXOpType.h
+++ b/compiler/mir-onnx-importer/ONNXOpType.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef NNCC_ONNX_OP_TYPES_H
-#define NNCC_ONNX_OP_TYPES_H
+#ifndef _MIR_ONNX_OP_TYPES_H
+#define _MIR_ONNX_OP_TYPES_H
-namespace nnc
+namespace mir_onnx
{
enum class ONNXOpSupportState
{
@@ -156,5 +156,5 @@ struct ONNXOpType
ONNXOpSupportState state;
}; // ONNXOpType
-} // namespace nnc
-#endif // NNCC_ONNX_OP_TYPES_H
+} // namespace mir_onnx
+#endif // _MIR_ONNX_OP_TYPES_H
diff --git a/compiler/mir-onnx-importer/ONNXPerfect.gperf b/compiler/mir-onnx-importer/ONNXPerfect.gperf
index 5bbc9c7..9a1ef98 100644
--- a/compiler/mir-onnx-importer/ONNXPerfect.gperf
+++ b/compiler/mir-onnx-importer/ONNXPerfect.gperf
@@ -17,7 +17,7 @@
#include "ONNXOpType.h"
-using namespace nnc;
+using namespace mir_onnx;
%}
diff --git a/compiler/mir-onnx-importer/ONNXPerfectHash.h b/compiler/mir-onnx-importer/ONNXPerfectHash.h
index b9aa5be..e3ab70d 100644
--- a/compiler/mir-onnx-importer/ONNXPerfectHash.h
+++ b/compiler/mir-onnx-importer/ONNXPerfectHash.h
@@ -18,7 +18,7 @@
/* Command-line: gperf --output-file=ONNXPerfectHash.h ONNXPerfect.gperf */
/* Computed positions: -k'1-2,$' */
-namespace nnc
+namespace mir_onnx
{
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) && ('%' == 37) && ('&' == 38) && \
@@ -425,4 +425,4 @@ const struct ONNXOpType *ONNXPerfectHash::getONNXOpType(const char *str, size_t
return nullptr;
} // ONNXPerfectHash::getONNXOpType (const char *str, size_t len)
-} // namespace nnc
+} // namespace mir_onnx
diff --git a/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.cpp b/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.cpp
index c983b57..deff3d1 100644
--- a/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.cpp
+++ b/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.cpp
@@ -22,7 +22,7 @@ namespace nnc
{
ONNXImporterPass::ONNXImporterPass(const std::string &filename)
- : _pimpl(new ONNXImporterImpl(filename))
+ : _pimpl(new mir_onnx::ONNXImporterImpl(filename))
{
}
diff --git a/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.h b/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.h
index 087ed57..25b3da5 100644
--- a/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.h
+++ b/compiler/nnc/passes/onnx_frontend/ONNXImporterPass.h
@@ -22,10 +22,13 @@
#include
#include
-namespace nnc
+namespace mir_onnx
{
+ class ONNXImporterImpl;
+}
-class ONNXImporterImpl;
+namespace nnc
+{
class ONNXImporterPass : public NNImporter
{
public:
@@ -38,7 +41,7 @@ public:
~ONNXImporterPass() override;
private:
- std::unique_ptr _pimpl;
+ std::unique_ptr _pimpl;
std::unique_ptr _graph;
};
--
2.7.4