--- /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 __COCO_IR_KERNEL_LAYOUTS_H__
+#define __COCO_IR_KERNEL_LAYOUTS_H__
+
+#include "coco/IR/KernelLayout.h"
+
+#include <memory>
+
+namespace coco
+{
+namespace KernelLayouts
+{
+
+/**
+ * @brief NCHW Kernel Layout
+ */
+class NCHW final : public KernelLayout
+{
+private:
+ NCHW(const nncc::core::ADT::kernel::Shape &shape) : _shape{shape}
+ {
+ // DO NOTHING
+ }
+
+public:
+ const nncc::core::ADT::kernel::Shape &shape(void) const override { return _shape; }
+
+ ElemID at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col) const override;
+
+private:
+ nncc::core::ADT::kernel::Shape _shape;
+
+public:
+ static std::unique_ptr<NCHW> create(const nncc::core::ADT::kernel::Shape &shape);
+};
+
+} // namespace KernelLayouts
+} // namespace coco
+
+#endif // __COCO_IR_KERNEL_LAYOUTS_H__
--- /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 "coco/IR/KernelLayouts.h"
+
+#include <nncc/core/ADT/kernel/NCHWLayout.h>
+
+#include <cassert>
+
+using namespace nncc::core::ADT::kernel;
+
+//
+// NCHW Layout
+//
+namespace coco
+{
+namespace KernelLayouts
+{
+
+ElemID NCHW::at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col) const
+{
+ static NCHWLayout l;
+ return ElemID{l.offset(_shape, n, ch, row, col)};
+}
+
+std::unique_ptr<NCHW> NCHW::create(const nncc::core::ADT::kernel::Shape &shape)
+{
+ // NOTE It is impossible to use make_unique here as the constructor is private
+ return std::unique_ptr<NCHW>{new NCHW{shape}};
+}
+
+} // namespace KernelLayouts
+} // namespace coco