From 54661ee9672d83b12e68c9ad96c5dc9217c5983d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Mon, 6 Aug 2018 11:30:48 +0900 Subject: [PATCH] [morph] Introduce 'caffe' namespace (#899) This commit introdcues 'caffe' namespaces in order to avoid name conflicts. Signed-off-by: Jonghyun Park --- contrib/morph/include/morph/caffe.h | 3 +++ contrib/morph/src/caffe.cpp | 3 +++ contrib/morph/src/caffe.test.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/contrib/morph/include/morph/caffe.h b/contrib/morph/include/morph/caffe.h index 1e01016..e8835fd 100644 --- a/contrib/morph/include/morph/caffe.h +++ b/contrib/morph/include/morph/caffe.h @@ -7,6 +7,8 @@ namespace morph { +namespace caffe +{ nncc::core::ADT::tensor::Shape as_tensor_shape(const nncc::core::ADT::feature::Shape &); nncc::core::ADT::tensor::Shape as_tensor_shape(const nncc::core::ADT::kernel::Shape &); @@ -14,6 +16,7 @@ nncc::core::ADT::tensor::Shape as_tensor_shape(const nncc::core::ADT::kernel::Sh nncc::core::ADT::feature::Shape as_feature_shape(const nncc::core::ADT::tensor::Shape &); nncc::core::ADT::kernel::Shape as_kernel_shape(const nncc::core::ADT::tensor::Shape &); +} // namespace caffe } // namespace morph #endif // __MORPH_CAFFE_H__ diff --git a/contrib/morph/src/caffe.cpp b/contrib/morph/src/caffe.cpp index 0073fe7..c0cc5d4 100644 --- a/contrib/morph/src/caffe.cpp +++ b/contrib/morph/src/caffe.cpp @@ -6,6 +6,8 @@ using namespace nncc::core::ADT; namespace morph { +namespace caffe +{ tensor::Shape as_tensor_shape(const feature::Shape &shape) { @@ -46,4 +48,5 @@ kernel::Shape as_kernel_shape(const tensor::Shape &shape) return kernel::Shape{shape.dim(0), shape.dim(1), shape.dim(2), shape.dim(3)}; } +} // namespace caffe } // namespace morph diff --git a/contrib/morph/src/caffe.test.cpp b/contrib/morph/src/caffe.test.cpp index 2407ddd..8da65f5 100644 --- a/contrib/morph/src/caffe.test.cpp +++ b/contrib/morph/src/caffe.test.cpp @@ -6,7 +6,7 @@ using namespace nncc::core::ADT; TEST(MORPH_CAFFE, as_feature_shape) { - auto shape = morph::as_feature_shape(tensor::Shape{1, 3, 4, 5}); + auto shape = morph::caffe::as_feature_shape(tensor::Shape{1, 3, 4, 5}); ASSERT_EQ(shape.depth(), 3); ASSERT_EQ(shape.height(), 4); @@ -15,7 +15,7 @@ TEST(MORPH_CAFFE, as_feature_shape) TEST(MORPH_CAFFE, as_kernel_shape) { - auto shape = morph::as_kernel_shape(tensor::Shape{2, 3, 4, 5}); + auto shape = morph::caffe::as_kernel_shape(tensor::Shape{2, 3, 4, 5}); ASSERT_EQ(shape.count(), 2); ASSERT_EQ(shape.depth(), 3); @@ -27,7 +27,7 @@ TEST(MORPH_CAFFE, as_tensor_shape) { // From feature::Shape { - auto shape = morph::as_tensor_shape(feature::Shape{2, 3, 4}); + auto shape = morph::caffe::as_tensor_shape(feature::Shape{2, 3, 4}); ASSERT_EQ(shape.rank(), 4); ASSERT_EQ(shape.dim(0), 1); @@ -38,7 +38,7 @@ TEST(MORPH_CAFFE, as_tensor_shape) // From kernel::Shape { - auto shape = morph::as_tensor_shape(kernel::Shape{2, 3, 4, 5}); + auto shape = morph::caffe::as_tensor_shape(kernel::Shape{2, 3, 4, 5}); ASSERT_EQ(shape.rank(), 4); ASSERT_EQ(shape.dim(0), 2); -- 2.7.4