forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDAnnNode.cpp
More file actions
94 lines (67 loc) · 2.17 KB
/
DAnnNode.cpp
File metadata and controls
94 lines (67 loc) · 2.17 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: DAnnNode.cpp
@Time: 2022/4/4 23:49
@Desc:
***************************/
#include "DAnnNode.h"
CGRAPH_NAMESPACE_BEGIN
DAnnNode::DAnnNode() {
setType(GNodeType::CPU); // 计算密集型算子
/** 初始化函数映射关系 */
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_TRAIN)] = &DAnnNode::train;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_SEARCH)] = &DAnnNode::search;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_INSERT)] = &DAnnNode::insert;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_UPDATE)] = &DAnnNode::update;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_REMOVE)] = &DAnnNode::remove;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_LOAD_MODEL)] = &DAnnNode::loadModel;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_SAVE_MODEL)] = &DAnnNode::saveModel;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_EDITION)] = &DAnnNode::edition;
}
CStatus DAnnNode::run() {
/**
* 整体流程思路
* 1,先准备参数,并且确定走哪个功能函数(必须实现)
* 2,执行具体功能函数
* 3,如有参数修改,将最终的参数同步回主流程
*/
CGRAPH_FUNCTION_BEGIN
const DAnnFuncType& funcType = prepareParam();
if (unlikely(funcType <= DAnnFuncType::ANN_PREPARE_ERROR
|| funcType >= DAnnFuncType::ANN_MAX_SIZE)) {
CGRAPH_RETURN_ERROR_STATUS("error ann function type")
}
status = (this->*ann_func_arr_[static_cast<CUint>(funcType)])();
CGRAPH_FUNCTION_CHECK_STATUS
status = refreshParam();
CGRAPH_FUNCTION_END
}
CStatus DAnnNode::train() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::search() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::insert() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::update() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::remove() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::loadModel() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::saveModel() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::edition() {
CGRAPH_NO_SUPPORT
}
CStatus DAnnNode::refreshParam() {
CGRAPH_EMPTY_FUNCTION
}
CGRAPH_NAMESPACE_END