return true;
}
+ bool visit(const coco::MaxPool2D *) override
+ {
+ // TODO Check data layout
+ return true;
+ }
+
bool visit(const coco::ReLU *) override
{
// TODO Check data layout
_binder->addOperation(ann::Operation::Code::RELU, {ifm}, {ofm});
}
+ else if (auto maxpool = unit->op()->asMaxPool2D())
+ {
+ auto ifm = _binder->addOperand<float>(unit->ifm());
+
+ // TODO Support padding
+ auto left = _binder->addOperand<int32_t>();
+ _binder->setOperand(left, 0);
+ auto right = _binder->addOperand<int32_t>();
+ _binder->setOperand(right, 0);
+ auto top = _binder->addOperand<int32_t>();
+ _binder->setOperand(top, 0);
+ auto bottom = _binder->addOperand<int32_t>();
+ _binder->setOperand(bottom, 0);
+
+ // TODO Support stride
+ auto hstride = _binder->addOperand<int32_t>();
+ _binder->setOperand(hstride, 1);
+ auto vstride = _binder->addOperand<int32_t>();
+ _binder->setOperand(vstride, 1);
+
+ // Set receptive field size
+ auto width = _binder->addOperand<int32_t>();
+ _binder->setOperand(width, maxpool->window()->horizontal());
+ auto height = _binder->addOperand<int32_t>();
+ _binder->setOperand(height, maxpool->window()->vertical());
+
+ // Set fuse code
+ // TODO Suport operation fusion
+ auto fuse = _binder->addOperand<int32_t>();
+ _binder->setOperand(fuse, 0);
+
+ auto ofm = _binder->addOperand<float>(unit->ofm());
+
+ _binder->addOperation(ann::Operation::Code::MAX_POOL_2D,
+ {ifm, left, right, top, bottom, hstride, vstride, width, height, fuse},
+ {ofm});
+ }
else
{
throw std::runtime_error{"Not supported, yet"};