#define __COCO_IR_KERNEL_OBJECT_H__
#include "coco/IR/Object.h"
-#include "coco/IR/KernelObjectInfo.forward.h"
#include "coco/IR/ElemID.h"
#include <nncc/core/ADT/kernel/Shape.h>
class KernelObject final : public Object
{
public:
- explicit KernelObject(std::unique_ptr<KernelObjectInfo> &&info);
+ explicit KernelObject(const nncc::core::ADT::kernel::Shape &shape);
public:
virtual ~KernelObject();
template <typename LayoutImpl> void reorder(void) { reorder(LayoutImpl{}); }
private:
- std::unique_ptr<KernelObjectInfo> _info;
-
+ nncc::core::ADT::kernel::Shape _shape;
std::vector<ElemID> _map;
};
+++ /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_OBJECT_INFO_FORWARD_H__
-#define __COCO_IR_KERNEL_OBJECT_INFO_FORWARD_H__
-
-namespace coco
-{
-
-class KernelObjectInfo;
-
-} // namespace coco
-
-#endif // __COCO_IR_KERNEL_OBJECT_INFO_FORWARD_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.
- */
-
-#ifndef __COCO_IR_KERNEL_OBJECT_INFO_H__
-#define __COCO_IR_KERNEL_OBJECT_INFO_H__
-
-#include <nncc/core/ADT/kernel/Shape.h>
-
-namespace coco
-{
-
-class KernelObjectInfo final
-{
-public:
- KernelObjectInfo(const nncc::core::ADT::kernel::Shape &shape) : _shape{shape}
- {
- // DO NOTHING
- }
-
-public:
- const nncc::core::ADT::kernel::Shape &shape(void) const { return _shape; }
-
-private:
- nncc::core::ADT::kernel::Shape const _shape;
-};
-
-} // namespace coco
-
-#endif // __COCO_IR_KERNEL_OBJECT_INFO_H__
*/
#include "coco/IR/KernelObject.h"
-#include "coco/IR/KernelObjectInfo.h"
#include <nncc/core/ADT/kernel/NCHWLayout.h>
namespace coco
{
-KernelObject::KernelObject(std::unique_ptr<KernelObjectInfo> &&info) : _info{std::move(info)}
+KernelObject::KernelObject(const nncc::core::ADT::kernel::Shape &shape) : _shape{shape}
{
- _map.resize(nncc::core::ADT::kernel::num_elements(shape()));
+ _map.resize(nncc::core::ADT::kernel::num_elements(shape));
}
KernelObject::~KernelObject()
// DO NOTHING
}
-const nncc::core::ADT::kernel::Shape &KernelObject::shape(void) const { return _info->shape(); }
+const nncc::core::ADT::kernel::Shape &KernelObject::shape(void) const { return _shape; }
ElemID &KernelObject::at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col)
{
*/
#include "coco/IR/KernelObject.h"
-#include "coco/IR/KernelObjectInfo.h"
#include <nncc/foundation/Memory.h>
protected:
coco::KernelObject *allocate(const kernel::Shape &shape)
{
- auto info = make_unique<coco::KernelObjectInfo>(shape);
- auto o = new coco::KernelObject{std::move(info)};
+ auto o = new coco::KernelObject{shape};
_allocated.emplace_back(o);
return o;
}
#include "coco/IR/FeatureObject.h"
#include "coco/IR/FeatureObjectInfo.h"
#include "coco/IR/KernelObject.h"
-#include "coco/IR/KernelObjectInfo.h"
#include <nncc/foundation/Memory.h>
KernelObject *ObjectManager::create(const nncc::core::ADT::kernel::Shape &shape)
{
- auto info = make_unique<KernelObjectInfo>(shape);
- auto info_ptr = info.get();
-
- auto kernel = make_unique<KernelObject>(std::move(info));
+ auto kernel = make_unique<KernelObject>(shape);
auto kernel_ptr = kernel.get();
modulize(kernel_ptr);