36 std::map<std::string, tensor::Shape> &shape_ctx = context->
shape_ctx();
37 std::map<std::string, coco::Bag *> &bag_ctx = context->
bag_ctx();
39 assert(layer.bottom().size() > 0);
40 assert(layer.top().size() == 1);
45 assert(!layer.has_concat_param());
46 const uint32_t concat_axis = 1;
49 std::vector<coco::FeatureObject *> input_objects;
51 for (
const auto &input_name : layer.bottom())
55 auto input_bag = bag_ctx.at(input_name);
56 auto input_feature =
module->entity()->object()->create<coco::FeatureObject>();
58 input_feature->bag(input_bag);
61 input_objects.emplace_back(input_feature);
66 assert(last_feature !=
nullptr);
67 assert(last_feature->
bag() !=
nullptr);
80 for (uint32_t n = 1; n < input_objects.size(); ++n)
82 auto const left_feature = last_feature;
83 auto const left_shape = left_feature->
layout()->
shape();
85 auto right_feature = input_objects.at(n);
86 auto right_shape = right_feature->layout()->shape();
89 assert(left_feature->layout()->batch() == 1);
90 assert(right_feature->layout()->batch() == 1);
93 assert(left_shape.height() == right_shape.height());
94 assert(left_shape.width() == right_shape.width());
96 const uint32_t C = left_shape.depth() + right_shape.depth();
97 const uint32_t H = left_shape.height();
98 const uint32_t W = left_shape.width();
102 auto out_bag =
module->entity()->bag()->create(num_elements(out_shape));
103 auto out_feature =
module->entity()->object()->create<coco::FeatureObject>();
105 out_feature->bag(out_bag);
111 auto concat_f =
module->entity()->op()->create<coco::ConcatF>();
114 concat_f->left(left_load);
115 concat_f->right(right_load);
120 blk->instr()->append(eval);
123 last_feature = out_feature;
126 assert(last_feature !=
nullptr);
127 assert(last_feature->
bag() !=
nullptr);
130 auto const out_name = layer.top(0);
132 auto const out_bag = last_feature->
bag();
134 bag_ctx[out_name] = out_bag;
135 shape_ctx[out_name] = out_shape;
ShapeContext & shape_ctx()