//
// UnitF
//
+#include "coco/IR/Op.forward.h"
+
namespace coco
{
/**
* @brief Feature map-to-feature map step with single NN operation
*
- * TODO Restrict 'OpImpl'
+ * TODO Introduce 'FeatureOp' and use it
*/
-template<typename OpImpl> class UnitF final : public FeatureInstr
+class UnitF final : public FeatureInstr
{
public:
UnitF(const PtrLink<Instr, Block> *link) : FeatureInstr{link}, _op{nullptr}
}
private:
- OpImpl *_op;
+ Op *_op;
public:
- OpImpl *op(void) const { return _op; }
+ Op *op(void) const { return _op; }
public:
- void op(OpImpl *op)
+ void op(Op *op)
{
// TODO Update Op-Instr relation
_op = op;
}
public:
- template<typename OpImpl> UnitF<OpImpl> *createF(void);
+ template<typename Ins> Ins *create(void);
private:
const PtrLink<Instr, Block> * const _instr_link;
--- /dev/null
+#ifndef __COCO_IR_OP_FORWARD_H__
+#define __COCO_IR_OP_FORWARD_H__
+
+namespace coco
+{
+
+struct Op;
+
+} // namespace coco
+
+#endif // __COCO_IR_OP_FORWARD_H__
TEST(IR_UNIT_F, ctor)
{
coco::PtrLink<coco::Instr, coco::Block> link;
- coco::UnitF<::DummyOp> ins{&link};
+ coco::UnitF ins{&link};
ASSERT_EQ(ins.op(), nullptr);
}
TEST(IR_UNIT_F, op_update)
{
coco::PtrLink<coco::Instr, coco::Block> link;
- coco::UnitF<::DummyOp> ins{&link};
+ coco::UnitF ins{&link};
::DummyOp op{};
namespace coco
{
-template<> UnitF<Conv2D> *InstrManager::createF()
+template<> UnitF *InstrManager::create(void)
{
- return take(nncc::foundation::make_unique<UnitF<Conv2D>>(_instr_link));
+ return take(nncc::foundation::make_unique<UnitF>(_instr_link));
}
} // namespace coco
// Conv2D
{
- auto ins = mgr.createF<coco::Conv2D>();
+ auto ins = mgr.create<coco::UnitF>();
ASSERT_NE(ins, nullptr);
}
}