Implement default implementation for `NodeVisitor::visit(Subgraph)`.
Remove override implementation of `IStageGenerator`.
The default implementation is NOP so SubTensorAnalyzer was not working.
SubTensorAnalyzer changes are necessary for this commit otherwise it
crashes.
Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
virtual void visit(const model::operation::InternalName &) override {}
#include "model/operation/Op.lst"
#undef OP
- virtual void visit(const model::operation::Subgraph &subgraph) final override
- {
- for (const auto &e : subgraph.operations())
- {
- e.node->accept(std::move(*this));
- }
- }
protected:
void returnStage(const StageFn fn)
// finalize: generate tensor using subtensor info, then execute stage
// Generated SubTensorInfo is in operand(Object)
// for easy pass SubTensorInfo to plan builder and tensor builder
- linear->accept(SubTensorAnalyzer{*_model});
+ linear->accept(SubTensorAnalyzer{*linear->getLowerInfo(), _model->operands()});
/**********************************************************
* Backend dependent analysis & optimization phase finished
int32_t axis_point = 0;
for (auto &input_index : inputs)
{
- auto lower_info = _graph.getLowerInfo(input_index);
+ auto lower_info = _lower_info.operand.at(input_index).get();
assert(lower_info != nullptr);
auto input_shape_4D = lower_info->shape();
std::vector<int32_t> offset = {0, 0, 0, 0};
* @brief Construct a new SubTensorAnalyzer object
* @param[in] ctx Graph operand set
*/
- SubTensorAnalyzer(graph::Graph &graph) : _graph{graph}, _ctx{graph.operands()} {}
+ SubTensorAnalyzer(const graph::LowerInfoMap &lower_info, neurun::model::operand::Set &ctx)
+ : _lower_info{lower_info}, _ctx{ctx}
+ {
+ }
public:
virtual void visit(const model::operation::ConcatNode &) override;
private:
- const neurun::graph::Graph &_graph;
- neurun::model::operand::Set &_ctx;
+ const graph::LowerInfoMap &_lower_info;
+ neurun::model::operand::Set &_ctx; // TODO Refactor : Do not update operand::Set
};
} // namespace compiler
#define __NEURUN_MODEL_OPERATION_NODE_VISITOR_H__
#include "Node.Include.h"
+#include "Subgraph.h"
namespace neurun
{
namespace operation
{
-class Subgraph;
-
struct NodeVisitor
{
virtual ~NodeVisitor() = default;
// This Subgraph node should be handled specially so that
// Op.lst doesn't have Subgraph
- virtual void visit(const Subgraph &) {}
+ virtual void visit(const Subgraph &subgraph)
+ {
+ for (const auto &e : subgraph.operations())
+ {
+ e.node->accept(std::move(*this));
+ }
+ }
};
} // namespace operation