This commit removes "node" method from GraphInput/GraphOutput class.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
#define __LOCO_IR_GRAPH_H__
#include "loco/IR/DataType.h"
+// TODO Include "Node.h" instead
#include "loco/IR/Nodes.h"
#include "loco/IR/NodePool.h"
#include "loco/IR/GraphInputIndex.h"
private:
uint32_t _index;
-
-public:
- Pull *node(void) const { return _pull; }
-private:
- // DEPRECATED
- //
- // Use a dialect-specific helper instead.
- //
- // TODO Remove this method
- void node(Pull *pull);
-
-private:
- Pull *_pull{nullptr};
};
/**
private:
uint32_t _index;
-
-public:
- Push *node(void) const { return _push; }
-private:
- // DEPRECATED
- //
- // Use a dialect-specific helper instead.
- //
- // TODO Remove this method
- void node(Push *push);
-
-private:
- Push *_push{nullptr};
};
/**
shape(make_tensor_shape(dims));
}
-void GraphInput::node(Pull *pull)
-{
- _pull = pull;
- assert(!_pull->indexed() or _pull->index() == _index);
- if (!_pull->indexed())
- {
- _pull->index(_index);
- }
-}
-
-void GraphOutput::node(Push *push)
-{
- _push = push;
- assert(!_push->indexed() or _push->index() == _index);
- if (!_push->indexed())
- {
- _push->index(_index);
- }
-}
-
GraphInput *Graph::InputContext::create(void)
{
return take(stdex::make_unique<GraphInput>(size()));
for (uint32_t n = 0; n < g->outputs()->size(); ++n)
{
- auto node = g->outputs()->at(n)->node();
+ auto node = push_node(g, n);
res.emplace_back(node);
}
EXPECT_EQ(ptr->nodes()->size(), 2);
EXPECT_EQ(ptr->inputs()->size(), 1);
- EXPECT_EQ(ptr->inputs()->at(0)->node(), pull);
- EXPECT_EQ(ptr->outputs()->at(0)->node(), push);
}
TEST(GraphTest, graph_node_enumeration)
auto output_nodes = loco::output_nodes(g.get());
ASSERT_EQ(output_nodes.size(), 2);
- ASSERT_EQ(output_nodes.at(0), g->outputs()->at(0)->node());
- ASSERT_EQ(output_nodes.at(1), g->outputs()->at(1)->node());
+ ASSERT_EQ(output_nodes.at(0), push_1);
+ ASSERT_EQ(output_nodes.at(1), push_3);
}
return graph()->outputs()->at(index())->shape()->dim(axis);
}
-void link(GraphOutput *output, Push *push)
-{
- output->node(push);
- push->index(output->index());
-}
+void link(GraphOutput *output, Push *push) { push->index(output->index()); }
Push *push_node(Graph *g, const GraphOutputIndex &index)
{
}
}
-void link(GraphInput *input, Pull *pull)
-{
- input->node(pull);
- pull->index(input->index());
-}
+void link(GraphInput *input, Pull *pull) { pull->index(input->index()); }
Pull *pull_node(Graph *g, const GraphInputIndex &index)
{