ae2f_docs
Slp.core.h
1#ifndef ae2f_Ann_Slp_Core_h
2#define ae2f_Ann_Slp_Core_h
3
4#include <ae2f/Float.h>
5#include <ae2f/errGlob.h>
6#include <ae2f/Cast.h>
7#include <ae2f/Call.h>
8#include <ae2f/Guide.h>
9
10#include "./Act.h"
11#include "./Util.h"
12
13#include <ae2f/Macro.h>
14#include <ae2f/Pack/Beg.h>
15
16/**
17 * @brief
18 * # Single Layered Perceptron
19 *
20 * Multiple input, multiple output. \n
21 * For predicting & training operations are able to be parallel.
22 */
23ae2f_structdef_n(struct, ae2f_AnnSlp_t, ae2f_AnnSlpREG_t) {
24 /**
25 * @brief
26 * input count
27 */
28 size_t m_inc;
29
30 /**
31 * @brief
32 * output count
33 */
34 size_t m_outc;
35};
36
37/**
38 * @brief
39 * Structure for SLP prediction and training data.
40 */
41ae2f_structdef_n(struct, ae2f_AnnSlpPredict_t, ae2f_AnnSlpPredictREG_t) {
42 /**
43 * @brief
44 * Loop counters and layer sizes.
45 */
46 size_t m_i, m_j;
47
48 ae2f_float_t m_ret;
49};
50
51ae2f_structdef(struct, ae2f_AnnSlpTrainREG_t) {
52 size_t m_i, m_j;
53
54 ae2f_float_t m_ret;
55
56};
57
58ae2f_structdef(struct, ae2f_AnnSlpTrain_t) {
59 /**
60 * @brief
61 * Loop counters and layer sizes.
62 */
63 size_t m_i, m_j;
64
65 ae2f_float_t m_ret;
66 ae2f_float_t m_tmp, m_tmp1;
67};
68
69ae2f_structdef(struct, ae2f_AnnSlpPredictOne_t) {
70 size_t m_j;
71 ae2f_float_t m_ret;
72 ae2f_float_t m_tmp;
73};
74
75ae2f_structdef(struct, ae2f_AnnSlpTrainOne_t) {
76 size_t m_j;
77 ae2f_float_t m_ret;
78 ae2f_float_t m_tmp, m_tmp1;
79};
80
81/**
82 * @brief
83 * Structure for a single step of the follow operation.
84 */
85ae2f_structdef_n(struct, ae2f_AnnSlpFollowOne_t, ae2f_AnnSlpFollowOneREG_t, ae2f_AnnSlpFitOne_t) {
86 /**
87 * @brief
88 * Loop counter.
89 */
90 size_t m_j;
91};
92
93
94ae2f_structdef(struct, ae2f_AnnSlp);
95
96ae2f_structdef(union, ae2f_AnnSlpMkU0_t) {
97 ae2f_float_t* ae2f_restrict a;
98 ae2f_AnnSlp* ae2f_restrict b;
99};
100
101/**
102 * @brief
103 * Structure for SLP creation data.
104 */
105ae2f_structdef_n(struct, ae2f_AnnSlpMk_t, ae2f_AnnSlpMkREG_t) {
106 /**
107 * @brief
108 * Stack size and allocation count.
109 */
110 size_t m_stack, m_alloccount;
111 /**
112 * @brief
113 * Pointer to the created SLP.
114 */
115 ae2f_AnnSlp* ae2f_restrict m_ptr;
116 /**
117 * @brief
118 * Field pointer for SLP data.
119 */
120 ae2f_AnnSlpMkU0_t m_fieldptr;
121};
122
124 struct
125 , ae2f_AnnSlpFollow_t
126 , ae2f_AnnSlpFollowREG_t
127 , ae2f_AnnSlpFitREG_t
128 , ae2f_AnnSlpFetchDeltaREG_t
129 )
130{
131 /**
132 * @brief
133 * Loop counters and layer sizes.
134 */
135 size_t m_i, m_j;
136};
137
138ae2f_structdef_n(struct, ae2f_AnnSlpFitRAM_t, ae2f_AnnSlpFetchDeltaRAM_t, ae2f_AnnSlpTrainRAM_t) {
139 ae2f_float_t m_tmp, m_tmp1;
140};
141
142/**
143 * @brief
144 * Structure for SLP follow, fit, and fetch delta operations.
145 */
146ae2f_structdef_n(struct, ae2f_AnnSlpFit_t, ae2f_AnnSlpFetchDelta_t) {
147 /**
148 * @brief
149 * Loop counters and layer sizes.
150 */
151 size_t m_i, m_j;
152 ae2f_float_t m_tmp, m_tmp1;
153};
154
155#include <ae2f/Pack/End.h>
156
157#endif
#define ae2f_structdef(key, name)
Definition Cast.h:110
#define ae2f_reinterpret_cast(t, v)
Definition Cast.h:52
#define unless(...)
Invokes when condition is false.
Definition Cast.h:103
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
Definition Cast.h:88
#define ae2f_structdef_n(key, name,...)
Definition Cast.h:109
#define ae2f_WhenCXX(...)
Appears when the current language is C.
Definition Cxx.h:37
#define ae2f_NONE
Literally nothing.
Definition Cxx.h:16
#define ae2f_LP(...)
Definition Guide.h:23
#define ae2f_FREE(...)
Definition Guide.h:33
#define ae2f_opt
Definition Guide.h:26
#define ae2f_errGlob_ALLOC_FAILED
stdlib allocating functions (malloc, calloc, realloc) has been failed.
Definition errGlob.h:40
uint8_t ae2f_err_t
Informs that this number represents the error.
Definition errGlob.h:19
#define ae2f_errGlob_PTR_IS_NULL
Failed to refer the pointer either l-value inside the function.
Definition errGlob.h:32
#define __ae2f_MACRO_GENERATED
Definition Conv.auto.h:2
#define ae2f_MAC_BUILD
Definition Util.h:5
#define ae2f_NEED_CLASS
Definition Mlp.cl.c:8
#define OPER_NONE
Definition Mlp.def.c:21
#define OPER_NEG
Definition Mlp.def.c:20
#define __ae2f_AnnMlpSz_imp(ret_sz, outc, weightc, depth, szswap, act, actderiv, deltastream, outcache, weight, bias)
Definition Mlp.auto.h:272
#define __ae2f_AnnMlpBwd_imp(v_tmp, v_send, slp_then, retdelta_then, deltaseed, actderiv_then, inp)
delta to delta
Definition Mlp.auto.h:588
#define __ae2f_AnnMlpHidDeltaSingle_imp(v_single, slp, weight, delta, iidx)
Definition Mlp.auto.h:566
#define __ae2f_AnnMlpPredictStream_imp(v_predict, mlp, inp, out, sz, weight, bias, outcache, act_opt)
Definition Mlp.auto.h:554
#define __ae2f_AnnMlpMk_imp(reg_mk, prm_depth, pprm_szvector, propptr_szswap_opt, lppfn_act_opt, lppfn_actderiv_opt, pfn_lossderiv, propptr_deltastream_opt, propptr_outcache_opt, propptr_weight_opt, propptr_bias_opt, prm_learningrate, prm_learningrate_bias, prm_offset_opt, prm_extra_opt)
Automatically allocates ae2f_AnnMlp and store its pointer at (reg_mk).m_mkbase.
Definition Mlp.auto.h:163
#define __ae2f_AnnMlpInitWithOutSz_imp(v_mlp, v_init, depth, outsz, weightsz, szvector, szswap_opt, act, actderiv, lossderiv, deltastream, outcache, weight, bias, learningrate, learningrate_bias)
Definition Mlp.auto.h:303
#define __ae2f_AnnMlpTrainPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out, out_desired)
Definition Mlp.auto.h:884
#define __ae2f_AnnMlpFollowPrimal_imp(OPER_NEG, OPER_NONE, v_follow, mlp, inp, delta, lenv, outstream, deltacache, weight, bias, learningrate, learningrate_bias, actderiv)
Definition Mlp.auto.h:615
#define __ae2f_AnnMlpPredictPrimal_imp(OPER_NEG, OPER_NONE, v_predict, mlp, inp, out, sz, weight, bias, outcache, act_opt)
layer must be more than 2
Definition Mlp.auto.h:397
#define __ae2f_AnnMlpTrainAutoPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out_desired)
Definition Mlp.auto.h:915
#define __ae2f_AnnMlpPredictPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out)
Definition Mlp.auto.h:524
#define __ae2f_AnnMlpFollowPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, delta)
Definition Mlp.auto.h:785
#define __ae2f_AnnMlpTrainPrimal_imp(OPER_NEG, OPER_NONE, v_train, mlp, inp, out, out_desired, lenv, outstream, deltacache, weight, bias, learningrate, learningrate_bias, act, actderiv, lossderiv)
Definition Mlp.auto.h:822
#define __ae2f_AnnSlpFollow_imp(reg_follow, prm_slp, pprm_in, pprm_delta, ptr_weight, ptr_bias, prm_learningrate, prm_learningrate_bias)
Definition Slp.auto.h:435
#define __ae2f_AnnSlpFit_C(...)
Definition Slp.auto.h:870
#define __ae2f_AnnSlpFollow_C(...)
Definition Slp.auto.h:524
#define __ae2f_AnnSlpFetchDelta_imp(tmp_delta, prm_slp, pprm_out, pprm_out_desired, fn_actderiv, fn_lossderiv, pret_delta)
Definition Slp.auto.h:586
#define __ae2f_AnnSlpFetchDelta_C(...)
Definition Slp.auto.h:701
#define __ae2f_AnnSlpDel_C
Definition Slp.auto.h:20
#define __ae2f_AnnSlpTrain_C
Definition Slp.auto.h:984
#define __ae2f_AnnSlpInit_C
Definition Slp.auto.h:139
#define __ae2f_AnnSlpPredict_imp(reg_predict, prmreg_slp, pprm_in, ret, ptr_outcache, pprm_weight, pprm_bias, fn_act)
Definition Slp.auto.h:278
#define __ae2f_AnnSlpMk_C
Definition Slp.auto.h:275
#define __ae2f_AnnSlpPredict_C(...)
Definition Slp.auto.h:376
#define ae2f_AnnSlpMk
Definition Slp.h:263
#define ae2f_AnnSlpDel
Definition Slp.h:264
#define ae2f_AnnSlpTrain
Definition Slp.h:268
#define ae2f_AnnSlpPredict
Definition Slp.h:265
#define ae2f_AnnSlpFollow
Definition Slp.h:266
#define ae2f_AnnSlpFit
Definition Slp.h:267
#define ae2f_MAC(...)
Definition mac.h:28