* [coco] Tree-like Conv2D op
This commit introduces 'arg' methods to Conv2D class, which allows
frontend to construct a tree-like structure with Conv2D Op.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Fix a typo
#define __COCO_IR_CONV2D_H__
#include "coco/IR/Op.h"
+#include "coco/IR/Part.h"
#include "coco/IR/KernelObject.h"
#include "coco/IR/Padding2D.h"
#include "coco/IR/Stride2D.h"
Use _ker;
public:
+ Op *arg(void) const { return _arg.child(); }
+ void arg(Op *arg) { _arg.child(arg); }
+
+public:
KernelObject *ker(void) const;
void ker(KernelObject *ker);
Padding2D _pad;
Stride2D _stride;
+
+private:
+ // @brief Link to an argument of Conv2D operation (= IFM)
+ Part _arg;
};
} // namespace coco
namespace coco
{
-Conv2D::Conv2D() : _ker{this}
+Conv2D::Conv2D() : _ker{this}, _arg{this}
{
// DO NOTHING
}
res.insert(ker());
}
+ if (auto ifm = arg())
+ {
+ for (auto obj : ifm->uses())
+ {
+ res.insert(obj);
+ }
+ }
+
return res;
}
{
auto op = allocate();
+ // arg() should be initialized as nullptr on construction
+ ASSERT_EQ(op->arg(), nullptr);
// ker() should be initialized as nullptr on construction
ASSERT_EQ(op->ker(), nullptr);