-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph.h
39 lines (28 loc) · 943 Bytes
/
graph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef GRAPH_H
#define GRAPH_H
#include <map>
#include <vector>
using namespace std;
#include "layer_register.h"
class Node;
class Graph
{
public:
Graph();
~Graph();
int load_model(string file_name);
void register_operand(string operand_name);
void register_operand(string operand_name, Tensor* operand_tensor);
void register_output(string operand_name, Node* node);
void input(string operand_name, Tensor* input_tensor);
int extract(string operand_name, Tensor* &output_tensor);
int get_result(string operand_name, Tensor* &output_tensor);
Tensor* find_operand(string operand_name);
private:
vector<Node*> _nodes;
map<string, Tensor*> _operand_map;
map<string, vector<Node*>> _exec_order_map;
map<string, Node*> _output_owner_map;
int topo_sort(string operand_name, vector<Node*> &exec_list);
};
#endif