#include <coco/IR.h>
/**
+ * @brief 2D Convolution through Andoird NN API
+ *
+ * TODO Support FusedActivation
+ */
+class ANNConv2D : public coco::Instr, public coco::Object::Producer, public coco::Object::Consumer
+{
+public:
+ ANNConv2D() : _ofm{this}, _ifm{this}, _ker{this}, _bias{this}
+ {
+ // DO NOTHING
+ }
+
+public:
+ coco::Instr *loc(void) override { return this; }
+
+public:
+ coco::Object *ofm(void) const { return _ofm.value(); }
+ void ofm(coco::Object *o) { _ofm.value(o); }
+
+ coco::Object *ifm(void) const { return _ifm.value(); }
+ void ifm(coco::Object *o) { _ifm.value(o); }
+
+ coco::Object *ker(void) const { return _ker.value(); }
+ void ker(coco::Object *o) { _ker.value(o); }
+
+ /**
+ * Currently, this "bias" is a Feature object with channel-wise layout
+ *
+ * NOTE This design is subject to change
+ */
+ coco::Object *bias(void) const { return _bias.value(); }
+ void bias(coco::Object *o) { _bias.value(o); }
+
+public:
+ coco::Padding2D *pad(void) { return &_pad; }
+ const coco::Padding2D *pad(void) const { return &_pad; }
+
+ coco::Stride2D *stride(void) { return &_stride; }
+ const coco::Stride2D *stride(void) const { return &_stride; }
+
+private:
+ coco::Def _ofm;
+
+ coco::Use _ifm;
+ coco::Use _ker;
+ coco::Use _bias;
+
+private:
+ coco::Padding2D _pad;
+ coco::Stride2D _stride;
+};
+
+/**
* @brief Concatenate feature maps along "depth" dimension through Andoird NN API
*/
class ANNDepthConcatF : public coco::Instr,
#include <gtest/gtest.h>
+TEST(IRTest, ANNConv2D_default_constructor)
+{
+ ANNConv2D ins;
+
+ ASSERT_EQ(ins.ofm(), nullptr);
+ ASSERT_EQ(ins.ifm(), nullptr);
+ ASSERT_EQ(ins.ker(), nullptr);
+ ASSERT_EQ(ins.bias(), nullptr);
+}
+
TEST(IRTest, ANNDepthConcatF_default_constructor)
{
ANNDepthConcatF ins;