33{
36 std::map<std::string, tensor::Shape> &shape_ctx = context->shape_ctx();
37 std::map<std::string, coco::Bag *> &bag_ctx = context->bag_ctx();
38
39 assert(layer.bottom().size() == 1);
40 assert(layer.top().size() == 1);
41
42
43
44 assert(!layer.has_relu_param());
45
46
47
48 const auto ifm_name = layer.bottom(0);
49 const auto ifm_shape = shape_ctx.at(ifm_name);
50 auto ifm_bag = bag_ctx.at(ifm_name);
51 auto ifm_obj = module->entity()->object()->create<coco::FeatureObject>();
52
53 ifm_obj->bag(ifm_bag);
55
56 const auto ofm_name = layer.top(0);
57 const auto ofm_shape = ifm_shape;
58 auto ofm_bag = module->entity()->bag()->create(num_elements(ofm_shape));
59 auto ofm_obj = module->entity()->object()->create<coco::FeatureObject>();
60
61 ofm_obj->bag(ofm_bag);
63
64
66
67
68 auto op = module->entity()->op()->create<coco::ReLU>();
69
71
72
74
75
76 blk->instr()->append(ins);
77
78
79 bag_ctx[ofm_name] = ofm_bag;
80 shape_ctx[ofm_name] = ofm_shape;
81}
OpBuilder op_builder(coco::Module *m)
InstrBuilder instr_builder(coco::Module *m)
coco::Eval * eval(coco::Object *out, coco::Op *op) const
Create "Eval" instruction with a given "Object" and "Op".
OpBuilder & load(coco::Object *obj)
Create "Load" op and push it onto the internal stack.
coco::Op * pop(void)
Pop op from the internal stack.
A unit of (grouped) instructions.
static std::unique_ptr< BCHW > create(const nncc::core::ADT::feature::Shape &shape)
Top-level element of coco IR which represents a neural network.
nncc::core::ADT::feature::Shape as_feature_shape(const nncc::core::ADT::tensor::Shape &)
TensorSignatures load(const char *info_path)
Function to create TensorSignatures defined in info file.
virtual Op * arg(uint32_t n) const =0
Return N-th argument.