--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Convert.h"
+
+using namespace nncc::core::ADT;
+
+namespace caffeimport
+{
+
+tensor::Shape as_tensor_shape(const ::caffe::BlobShape &blob_shape)
+{
+ const uint32_t rank = blob_shape.dim_size();
+
+ tensor::Shape res;
+
+ res.resize(rank);
+
+ for (uint32_t axis = 0; axis < rank; ++axis)
+ {
+ res.dim(axis) = blob_shape.dim(axis);
+ }
+
+ return res;
+}
+
+} // namespace caffeimport
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CONVERT_H__
+#define __CONVERT_H__
+
+#include <nncc/core/ADT/tensor/Shape.h>
+
+#include <caffe/proto/caffe.pb.h>
+
+namespace caffeimport
+{
+
+nncc::core::ADT::tensor::Shape as_tensor_shape(const ::caffe::BlobShape &blob_shape);
+
+inline nncc::core::ADT::tensor::Shape as_tensor_shape(const ::caffe::BlobProto *blob_proto)
+{
+ return as_tensor_shape(blob_proto->shape());
+}
+
+} // namespace caffeimport
+
+#endif // __CONVERT_H__
#include "PoolingSpec.h"
#include "ConcatSpec.h"
#include "Context.h"
+#include "Convert.h"
#include <coco/IR/FeatureLayouts.h>
#include <coco/IR/KernelLayouts.h>
using nncc::foundation::make_unique;
-namespace
-{
-
-tensor::Shape as_tensor_shape(const ::caffe::BlobShape &blob_shape)
-{
- const uint32_t rank = blob_shape.dim_size();
-
- tensor::Shape res;
-
- res.resize(rank);
-
- for (uint32_t axis = 0; axis < rank; ++axis)
- {
- res.dim(axis) = blob_shape.dim(axis);
- }
-
- return res;
-}
-
-tensor::Shape as_tensor_shape(const ::caffe::BlobProto *blob_proto)
-{
- return as_tensor_shape(blob_proto->shape());
-}
-
-} // namespace
-
/**
* coco IR builders
*/
for (uint32_t n = 0; n < layer.top_size(); ++n)
{
const auto &name = layer.top(n);
- const auto shape = as_tensor_shape(param.shape(n));
+ const auto shape = caffeimport::as_tensor_shape(param.shape(n));
auto bag = m->entity()->bag()->create(num_elements(shape));
auto input = m->entity()->input()->create(shape);
assert(weight_ctx.blob_count(layer.name()) >= 1);
auto ker_blob = weight_ctx.blob_get(layer.name(), 0);
- assert(ker_shape == as_tensor_shape(ker_blob));
+ assert(ker_shape == caffeimport::as_tensor_shape(ker_blob));
auto ker_dst = d->f32()->access(ker_obj);
auto ker_src = kernel::OverlayFactory<float, kernel::NCHWLayout>::make(