CGraph
Protected Member Functions | Private Types | Private Attributes | List of all members
DAnnNode Class Referenceabstract

ANN领域算子模型抽象,说人话,就是抽象了一套跑NN相关的范式 prepareParam准备要接下来要run的函数类型 函数类型和DAnnNode的成员函数一一对应,分别有 train/search/insert/update/remove/loadModel/saveModel/edition; 上述接口在DAnnNode这个基类都为空,由派生类自行实现,在run统一调用; More...

#include <DAnnNode.h>

Inheritance diagram for DAnnNode:
Inheritance graph
[legend]
Collaboration diagram for DAnnNode:
Collaboration graph
[legend]

Protected Member Functions

virtual DAnnFuncType prepareParam ()=0
 
virtual CStatus train ()
 
virtual CStatus search ()
 
virtual CStatus insert ()
 
virtual CStatus update ()
 
virtual CStatus remove ()
 
virtual CStatus loadModel ()
 
virtual CStatus saveModel ()
 
virtual CStatus edition ()
 
virtual CStatus refreshParam ()
 
 DAnnNode ()
 
CStatus run () override
 
- Protected Member Functions inherited from DAnnObject
CStatus run () override
 
- Protected Member Functions inherited from GNode
 GNode ()
 
GNodesetType (const GNodeType &type)
 
CStatus spawn (const UTaskGroup &tasks, CMSec ttl=CGRAPH_MAX_BLOCK_TTL)
 
- Protected Member Functions inherited from GElement
 GElement ()=default
 
 ~GElement () override
 
virtual CStatus prepareRun ()
 
virtual CStatus checkRunResult ()
 
virtual CBool isHold ()
 
virtual CBool isMatch ()
 
CStatus crashed (const CException &ex)
 
template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > = 0>
T * getEParam (const std::string &key)
 
CIndex getThreadIndex ()
 
CBool isTimeout () const
 
CIndex getBindingIndex () const
 
GElementRelation getRelation () const
 
 CGRAPH_NO_ALLOWED_COPY (GElement)
 

Private Types

typedef CStatus(DAnnNode::* DAnnNodeFuncPtr) ()
 

Private Attributes

DAnnNodeFuncPtr ann_func_arr_ [static_cast< CUInt >(DAnnFuncType::ANN_MAX_SIZE)] {}
 

Additional Inherited Members

- Public Member Functions inherited from CObject
 CObject ()=default
 
virtual CStatus init ()
 
virtual CStatus destroy ()
 
virtual ~CObject ()=default
 
- Public Member Functions inherited from GElement
template<typename TAspect , typename TParam = GAspectDefaultParam, c_enable_if_t< std::is_base_of< GAspect, TAspect >::value, int > = 0, c_enable_if_t< std::is_base_of< GAspectParam, TParam >::value, int > = 0>
GElementaddGAspect (TParam *param=nullptr)
 
template<typename TAspect , typename ... Args, c_enable_if_t< std::is_base_of< GTemplateAspect< Args... >, TAspect >::value, int > = 0>
GElementaddGAspect (Args... args)
 
template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > = 0>
GElementaddEParam (const std::string &key, T *param)
 
CStatus addDependGElements (const std::set< GElement * > &elements)
 
GElementsetName (const std::string &name) override
 
GElementsetLoop (CSize loop)
 
GElementsetLevel (CLevel level)
 
GElementsetVisible (CBool visible)
 
GElementsetBindingIndex (CIndex index)
 
GElementsetTimeout (CMSec timeout, GElementTimeoutStrategy strategy=GElementTimeoutStrategy::AS_ERROR)
 
GElementsetMacro (CBool macro)
 
CBool isGGroup () const
 
CBool isGAdaptor () const
 
CBool isGNode () const
 
GElementState getCurState () const
 
CStatus removeDepend (GElement *element)
 
GElementoperator-- (int) noexcept
 
GElementoperator> (GElement *element)
 
GElementoperator& (GElement *element)
 
GElementoperator* (CSize loop) noexcept
 
template<typename TAspect , typename TParam , c_enable_if_t< std::is_base_of< GAspect, TAspect >::value, int > , c_enable_if_t< std::is_base_of< GAspectParam, TParam >::value, int > >
CGRAPH_NAMESPACE_BEGIN GElementPtr addGAspect (TParam *param)
 
template<typename TAspect , typename ... Args, c_enable_if_t< std::is_base_of< GTemplateAspect< Args... >, TAspect >::value, int > >
GElementPtr addGAspect (Args... args)
 
template<typename T , c_enable_if_t< std::is_base_of< GElementParam, T >::value, int > >
GElementPtr addEParam (const std::string &key, T *param)
 
- Public Member Functions inherited from CDescInfo
virtual const std::string & getName () const
 
const std::string & getSession () const
 
const std::string & getDescription () const
 
virtual auto setDescription (const std::string &description) -> decltype(this)
 
virtual ~CDescInfo ()=default
 
- Protected Attributes inherited from CDescInfo
std::string name_
 
std::string session_
 
std::string description_
 

Detailed Description

ANN领域算子模型抽象,说人话,就是抽象了一套跑NN相关的范式 prepareParam准备要接下来要run的函数类型 函数类型和DAnnNode的成员函数一一对应,分别有 train/search/insert/update/remove/loadModel/saveModel/edition; 上述接口在DAnnNode这个基类都为空,由派生类自行实现,在run统一调用;

run的调用逻辑: prepareParam为纯虚函数,派生类必须重写,返回的是接下来run要跑的函数类型 接着run会调用这个函数类型在ann_func_arr_实际注册的函数 最后再调用一次refreshParam刷新参数

P.S. 感觉用处不大,和目前常用的 前处理 -> NN -> 后处理 不太match,倒是比较契合算法的模型训练流程?

Member Typedef Documentation

◆ DAnnNodeFuncPtr

typedef CStatus(DAnnNode::* DAnnNode::DAnnNodeFuncPtr) ()
private

Constructor & Destructor Documentation

◆ DAnnNode()

CGRAPH_NAMESPACE_BEGIN DAnnNode::DAnnNode ( )
explicitprotected

构造函数信息

初始化函数映射关系

Here is the call graph for this function:

Member Function Documentation

◆ edition()

CStatus DAnnNode::edition ( )
protectedvirtual

其他方法

◆ insert()

CStatus DAnnNode::insert ( )
protectedvirtual

插入

Returns

◆ loadModel()

CStatus DAnnNode::loadModel ( )
protectedvirtual

加载模型信息

Returns

◆ prepareParam()

virtual DAnnFuncType DAnnNode::prepareParam ( )
protectedpure virtual

预处理参数信息,并且返回需要执行的函数信息

Returns

◆ refreshParam()

CStatus DAnnNode::refreshParam ( )
protectedvirtual

将参数更新,作用于所有功能函数之后

Returns

◆ remove()

CStatus DAnnNode::remove ( )
protectedvirtual

删除

Returns

◆ run()

CStatus DAnnNode::run ( )
overrideprotectedvirtual

分拆执行函数

Returns

整体流程思路 1,先准备参数,并且确定走哪个功能函数(必须实现) 2,执行具体功能函数 3,如有参数修改,将最终的参数同步回主流程

Implements CObject.

Here is the call graph for this function:

◆ saveModel()

CStatus DAnnNode::saveModel ( )
protectedvirtual

保存模型信息

Returns

◆ search()

CStatus DAnnNode::search ( )
protectedvirtual

查询

Returns

◆ train()

CStatus DAnnNode::train ( )
protectedvirtual

训练

Returns

◆ update()

CStatus DAnnNode::update ( )
protectedvirtual

修改

Returns

Member Data Documentation

◆ ann_func_arr_

DAnnNodeFuncPtr DAnnNode::ann_func_arr_[static_cast< CUInt >(DAnnFuncType::ANN_MAX_SIZE)] {}
private

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