Let's clean up deprecated FixedArityNode class.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
Subst<SubstQualifier::Default> replace(Node *node);
-/**
- * @brief Nodes with the fixed number of inputs
- */
-template <unsigned N, typename Base> class FixedArityNode : public Base
-{
-public:
- FixedArityNode()
- {
- for (uint32_t n = 0; n < N; ++n)
- {
- _args[n] = std::unique_ptr<Use>{new Use{this}};
- }
- }
-
- virtual ~FixedArityNode() = default;
-
-public:
- unsigned arity(void) const final { return N; }
-
- Node *arg(uint32_t n) const final { return _args.at(n)->node(); }
-
- void drop(void) final
- {
- for (uint32_t n = 0; n < N; ++n)
- {
- _args.at(n)->node(nullptr);
- }
- }
-
-protected:
- // This API allows inherited classes to access "_args" field.
- Use *at(unsigned n) const { return _args.at(n).get(); }
-
-private:
- std::array<std::unique_ptr<Use>, N> _args;
-};
-
} // namespace loco
#endif // __LOCO_IR_NODE_H__
ASSERT_EQ(node.graph(), nullptr);
}
+// TODO Rewrite this as a FixedAritry mix-in test
+#if 0
TEST(FixedArityNodeTest, constructor)
{
struct DerivedNode final : public loco::FixedArityNode<1, loco::Node>
ASSERT_EQ(node.arity(), 1);
ASSERT_EQ(node.arg(0), nullptr);
}
+#endif
};
template <uint32_t D1, uint32_t D2>
-struct TestOpNode final : public loco::FixedArityNode<1, loco::Node>,
+struct TestOpNode final : public loco::FixedArity<1>::Mixin<loco::Node>,
public loco::NodeMixin<loco::NodeTrait::TensorShape>
{
void input(Node *node) { at(0)->node(node); }
};
template <loco::DataType N>
-struct TestOpNode final : public loco::FixedArityNode<1, loco::Node>,
+struct TestOpNode final : public loco::FixedArity<1>::Mixin<loco::Node>,
public loco::NodeMixin<loco::NodeTrait::DataType>
{
void input(Node *node) { at(0)->node(node); }