#include "PoolingSpec.h"
#include "ConcatSpec.h"
+#include <coco/IR/FeatureLayouts.h>
+
#include <nncc/core/ADT/feature/CHWLayout.h>
#include <nncc/core/ADT/kernel/Shape.h>
#include <nncc/core/ADT/kernel/Overlay.h>
const auto ifm_shape = shape_ctx.at(ifm_name);
auto ifm_bag = bag_ctx.at(ifm_name);
auto ifm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ifm_shape));
- auto ifm_layout = make_unique<coco::GenericFeatureLayout>(ifm_obj->shape());
-
- ifm_layout->reorder(feature::CHWLayout{});
ifm_obj->bag(ifm_bag);
- ifm_obj->layout(std::move(ifm_layout));
+ ifm_obj->layout(coco::FeatureLayouts::BCHW::create(ifm_obj->shape()));
// Create an object for an output feature map
const auto ofm_name = layer.top(0);
const auto ofm_shape = spec.ofm_shape();
auto ofm_bag = m->entity()->bag()->create(num_elements(ofm_shape));
auto ofm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ofm_shape));
- auto ofm_layout = make_unique<coco::GenericFeatureLayout>(ofm_obj->shape());
-
- ofm_layout->reorder(feature::CHWLayout{});
ofm_obj->bag(ofm_bag);
- ofm_obj->layout(std::move(ofm_layout));
+ ofm_obj->layout(coco::FeatureLayouts::BCHW::create(ofm_obj->shape()));
// Create an object for kernel
const auto ker_shape = spec.ker_shape();
const auto ifm_shape = shape_ctx.at(ifm_name);
auto ifm_bag = bag_ctx.at(ifm_name);
auto ifm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ifm_shape));
- auto ifm_layout = make_unique<coco::GenericFeatureLayout>(ifm_obj->shape());
-
- ifm_layout->reorder(feature::CHWLayout{});
ifm_obj->bag(ifm_bag);
- ifm_obj->layout(std::move(ifm_layout));
+ ifm_obj->layout(coco::FeatureLayouts::BCHW::create(ifm_obj->shape()));
// Create an object for an output feature map
const auto ofm_name = layer.top(0);
const auto ofm_shape = spec.ofm_shape();
auto ofm_bag = m->entity()->bag()->create(num_elements(ofm_shape));
auto ofm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ofm_shape));
- auto ofm_layout = make_unique<coco::GenericFeatureLayout>(ofm_obj->shape());
-
- ofm_layout->reorder(feature::CHWLayout{});
ofm_obj->bag(ofm_bag);
- ofm_obj->layout(std::move(ofm_layout));
+ ofm_obj->layout(coco::FeatureLayouts::BCHW::create(ofm_obj->shape()));
using PoolingOpBuilder = std::function<coco::Op *(coco::Module * m, const PoolingSpec &spec)>;
const auto ifm_shape = shape_ctx.at(ifm_name);
auto ifm_bag = bag_ctx.at(ifm_name);
auto ifm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ifm_shape));
- auto ifm_layout = make_unique<coco::GenericFeatureLayout>(ifm_obj->shape());
-
- ifm_layout->reorder(feature::CHWLayout{});
ifm_obj->bag(ifm_bag);
- ifm_obj->layout(std::move(ifm_layout));
+ ifm_obj->layout(coco::FeatureLayouts::BCHW::create(ifm_obj->shape()));
const auto ofm_name = layer.top(0);
const auto ofm_shape = ifm_shape;
auto ofm_bag = m->entity()->bag()->create(num_elements(ofm_shape));
auto ofm_obj = m->entity()->object()->create(morph::caffe::as_feature_shape(ofm_shape));
- auto ofm_layout = make_unique<coco::GenericFeatureLayout>(ofm_obj->shape());
-
- ofm_layout->reorder(feature::CHWLayout{});
ofm_obj->bag(ofm_bag);
- ofm_obj->layout(std::move(ofm_layout));
+ ofm_obj->layout(coco::FeatureLayouts::BCHW::create(ofm_obj->shape()));
// Create a ReLU op
auto op = m->entity()->op()->create<coco::ReLU>();