ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::test::TestGraph Class Reference

#include <TestGraph.h>

Collaboration diagram for luci::test::TestGraph:

Public Member Functions

 TestGraph ()
 
loco::Graphgraph ()
 
template<class T >
T * append ()
 Creates node with NO arg and appends it to graph.
 
template<class T >
T * append (luci::CircleNode *arg1)
 Creates op T (arity=1) with arg1 as an input and appends it to graph.
 
template<class T >
T * append (luci::CircleNode *arg1, luci::CircleNode *arg2)
 Creates op T (arity=2) with arg1, arg2 as inputs and appends it to graph.
 
template<class T >
T * append (luci::CircleNode *arg1, luci::CircleNode *arg2, luci::CircleNode *arg3)
 Creates op T (arity=3) with arg1, arg2, arg3 as inputs and appends it to graph.
 
void complete ()
 
void complete (luci::CircleNode *last_node)
 

Data Fields

std::unique_ptr< loco::Graphg
 
luci::CircleInputinput_node = nullptr
 
luci::CircleOutputoutput_node = nullptr
 

Detailed Description

Definition at line 34 of file TestGraph.h.

Constructor & Destructor Documentation

◆ TestGraph()

luci::test::TestGraph::TestGraph ( )
inline

Definition at line 41 of file TestGraph.h.

42 {
44
45 input_node = g->nodes()->create<luci::CircleInput>();
46
47 output_node = g->nodes()->create<luci::CircleOutput>();
48
49 auto input = g->inputs()->create();
50 {
51 input->name("input");
52 luci::link(input, input_node);
53 }
54 auto output = g->outputs()->create();
55 {
56 output->name("output");
57 luci::link(output, output_node);
58 }
59
60 _next_input = input_node;
61 }
CircleNode used for Input of the Graph.
Definition CircleInput.h:36
CircleNode for Output of the Graph.
luci::CircleOutput * output_node
Definition TestGraph.h:39
luci::CircleInput * input_node
Definition TestGraph.h:38
std::unique_ptr< loco::Graph > g
Definition TestGraph.h:37
std::unique_ptr< Graph > make_graph(void)
Definition Graph.cpp:131
void link(loco::GraphOutput *, CircleOutput *)
Link GraphOutput with CircleOutput node.

References g, input_node, luci::link(), loco::make_graph(), and output_node.

Member Function Documentation

◆ append() [1/4]

template<class T >
T * luci::test::TestGraph::append ( )
inline

Creates node with NO arg and appends it to graph.

Definition at line 66 of file TestGraph.h.

67 {
68 auto node = g->nodes()->create<T>();
69 _next_input = node;
70
71 return node;
72 }

References g.

◆ append() [2/4]

template<class T >
T * luci::test::TestGraph::append ( luci::CircleNode arg1)
inline

Creates op T (arity=1) with arg1 as an input and appends it to graph.

Definition at line 75 of file TestGraph.h.

76 {
77 auto node = g->nodes()->create<T>();
78 setInput(node, arg1);
79 _next_input = node;
80
81 return node;
82 }

References g.

◆ append() [3/4]

template<class T >
T * luci::test::TestGraph::append ( luci::CircleNode arg1,
luci::CircleNode arg2 
)
inline

Creates op T (arity=2) with arg1, arg2 as inputs and appends it to graph.

Definition at line 85 of file TestGraph.h.

86 {
87 auto node = g->nodes()->create<T>();
88 setInput(node, arg1, arg2);
89 _next_input = node;
90
91 return node;
92 }

References g.

◆ append() [4/4]

template<class T >
T * luci::test::TestGraph::append ( luci::CircleNode arg1,
luci::CircleNode arg2,
luci::CircleNode arg3 
)
inline

Creates op T (arity=3) with arg1, arg2, arg3 as inputs and appends it to graph.

Definition at line 96 of file TestGraph.h.

97 {
98 auto node = g->nodes()->create<T>();
99 setInput(node, arg1, arg2, arg3);
100 _next_input = node;
101
102 return node;
103 }

References g.

◆ complete() [1/2]

void luci::test::TestGraph::complete ( )
inline

Definition at line 106 of file TestGraph.h.

106{ output_node->from(_next_input); }
loco::Node * from(void) const

References luci::CircleOutput::from(), and output_node.

◆ complete() [2/2]

void luci::test::TestGraph::complete ( luci::CircleNode last_node)
inline

Definition at line 108 of file TestGraph.h.

108{ output_node->from(last_node); }

References luci::CircleOutput::from(), and output_node.

◆ graph()

loco::Graph * luci::test::TestGraph::graph ( )
inline

Definition at line 63 of file TestGraph.h.

63{ return g.get(); }

References g.

Referenced by TopologicalSortHelper.TopologicalSortHelper::add_edge(), and TopologicalSortHelper.TopologicalSortHelper::sort_util().

Field Documentation

◆ g

std::unique_ptr<loco::Graph> luci::test::TestGraph::g

Definition at line 37 of file TestGraph.h.

Referenced by append(), append(), append(), append(), graph(), and TestGraph().

◆ input_node

luci::CircleInput* luci::test::TestGraph::input_node = nullptr

Definition at line 38 of file TestGraph.h.

Referenced by TestGraph().

◆ output_node

luci::CircleOutput* luci::test::TestGraph::output_node = nullptr

Definition at line 39 of file TestGraph.h.

Referenced by complete(), complete(), and TestGraph().


The documentation for this class was generated from the following file: