2#define ae2f_NEED_CLASS 1
11#include <ae2f/Pack/Beg.h>
14
15
16
17
18
23
24
25
26 ae2f_float_t* ae2f_restrict m_weight;
28
29
30
31 ae2f_float_t* ae2f_restrict m_bias;
33
34
35
36 ae2f_float_t* ae2f_restrict m_cachedelta;
39 ae2f_float_t* ae2f_restrict m_cacheact;
42
43
44
45 ae2f_AnnSlpREG_t m_Slp[1];
48
49
50
51 ae2f_AnnActFFN_t * m_act;
53
54
55
56 ae2f_AnnActFFN_t * m_actderiv;
58
59
60
61 ae2f_AnnLossFFN_t* m_lossderiv;
64
65
66
67 ae2f_float_t m_learningrate;
69
70
71
72 ae2f_float_t m_learningrate_bias;
77 inline static void ae2f_TMP operator
delete(
void* end);
78 inline static void* ae2f_TMP operator
new(
80 ,
ae2f_LP(inc * outc) ae2f_float_t* ae2f_restrict
const weight_opt,
81 ae2f_LP(outc) ae2f_float_t* ae2f_restrict
const bias_opt,
82 ae2f_LP(outc) ae2f_float_t* ae2f_restrict
const cache_opt,
86 const size_t offset_opt,
88 ae2f_opt ae2f_AnnActFFN_t*
const act,
89 ae2f_opt ae2f_AnnActFFN_t*
const actderiv,
90 ae2f_AnnLossFFN_t*
const lossderiv,
91 ae2f_float_t learningrate,
92 ae2f_float_t learningrate_bias,
96 inline void ae2f_TMP Predict(
99 const ae2f_float_t*
const prm_in
101 ae2f_float_t*
const out
104 inline void ae2f_TMP Follow(
107 const ae2f_float_t*
const prm_in
109 const ae2f_float_t*
const delta
112 inline void ae2f_TMP Fit(
114 ,
ae2f_LP(_this::inc)
const ae2f_float_t*
const prm_inp
115 ,
ae2f_LP(_this::outc)
const ae2f_float_t*
const prm_out
116 ,
ae2f_LP(_this::outc)
const ae2f_float_t*
const prm_out_desired
119 inline void ae2f_TMP Train(
121 ,
ae2f_LP(slp::inc)
const ae2f_float_t* inp
122 ,
ae2f_LP(slp::outc)
const ae2f_float_t* out_desired
131#include <ae2f/Pack/End.h>
135
136
137
138
139
140
141
142#define ae2f_AnnSlpFieldSz(inc, outc) ((((inc) + 2
) * ((outc)) * sizeof(ae2f_float_t)) + sizeof(ae2f_AnnSlp))
147
148
149
150
151
153 ae2f_AnnSlpREG_t* ae2f_restrict _this,
156 const size_t offset_opt,
158 size_t* ae2f_restrict
const initsz_opt
162
163
164
165
166
167
168
170 ae2f_LP(inc * outc) ae2f_float_t* ae2f_restrict
const weight_opt,
171 ae2f_LP(outc) ae2f_float_t* ae2f_restrict
const bias_opt,
172 ae2f_LP(outc) ae2f_float_t* ae2f_restrict
const cache_opt,
176 const size_t offset_opt,
177 const size_t extra_opt,
178 ae2f_FREE(ae2f_AnnSlpDel, __ae2f_AnnSlpDel)
179 ae2f_AnnSlp* ae2f_restrict * ae2f_restrict
const slp,
180 ae2f_opt ae2f_AnnActFFN_t*
const act,
181 ae2f_opt ae2f_AnnActFFN_t*
const actderiv,
182 ae2f_AnnLossFFN_t*
const lossderiv,
183 ae2f_float_t learningrate,
184 ae2f_float_t learningrate_bias,
189 ae2f_AnnSlp* ae2f_restrict
const slp
192ae2f_extern ae2f_SHAREDCALL
void ae2f_AnnSlpPredict(
194 ,
const ae2f_AnnSlp* ae2f_restrict
const _this
196 const ae2f_float_t* ae2f_restrict
const prm_in
198 ae2f_float_t* ae2f_restrict
const out
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
220 ,
const ae2f_AnnSlp* ae2f_restrict
const _this
222 const ae2f_float_t* ae2f_restrict
const prm_in
224 const ae2f_float_t* ae2f_restrict
const delta
228
229
230
233 ,
const ae2f_AnnSlp*
const _this
234 ,
ae2f_LP(_this::inc)
const ae2f_float_t* ae2f_restrict
const prm_inp
235 ,
ae2f_LP(_this::outc)
const ae2f_float_t* ae2f_restrict
const prm_out
236 ,
ae2f_LP(_this::outc)
const ae2f_float_t* ae2f_restrict
const prm_out_desired
240 ae2f_extern ae2f_SHAREDCALL
void ae2f_AnnSlpFetchDelta(
242 ,
const ae2f_AnnSlp* ae2f_restrict slp
244 ,
ae2f_LP(slp::outc)
const ae2f_float_t* ae2f_restrict
const out
245 ,
ae2f_LP(slp::outc)
const ae2f_float_t* ae2f_restrict
const out_desired
247 ,
ae2f_LP(slp::outc) ae2f_float_t* ae2f_restrict
const retdelta
253 , ae2f_AnnSlp* ae2f_restrict slp
254 ,
ae2f_LP(slp::inc)
const ae2f_float_t* ae2f_restrict inp
255 ,
ae2f_LP(slp::outc)
const ae2f_float_t* ae2f_restrict out_desired
276#include "./Slp.auto.h"
278#define __ae2f_AnnSlpMk_imp(v_mk, p_weight_opt, p_bias_opt, p_cache_opt,
279 inc, outc, offset_opt, extra_opt, act, actderiv, lossderiv, lr_w, lr_b)
280 __ae2f_AnnSlpMkVerbose_imp
(
281 v_mk, p_weight_opt, p_bias_opt, p_cache_opt
283 , inc, outc, offset_opt, extra_opt, act, actderiv, lossderiv, lr_w, lr_b)
286#define ae2f_Ann_Slp_cc
288#define ae2f_TMP ae2f_AnnSlp::
290inline void ae2f_TMP operator
delete(
void* end) {
294inline void* ae2f_TMP operator
new(
296 ,
ae2f_LP(inc * outc) ae2f_float_t*
const weight_opt,
297 ae2f_LP(outc) ae2f_float_t*
const bias_opt,
298 ae2f_LP(outc) ae2f_float_t*
const cache_opt,
302 const size_t offset_opt,
304 ae2f_opt ae2f_AnnActFFN_t*
const act,
305 ae2f_opt ae2f_AnnActFFN_t*
const actderiv,
306 ae2f_AnnLossFFN_t*
const lossderiv,
307 ae2f_float_t learningrate,
308 ae2f_float_t learningrate_bias,
312 if(oneonly !=
sizeof(ae2f_AnnSlp))
return 0;
313 ae2f_AnnSlp* __v[1] = { NULL };
316 weight_opt, bias_opt, cache_opt, inc, outc, offset_opt, 0
317 , __v, act, actderiv, lossderiv, learningrate, learningrate_bias, err_opt);
322inline void ae2f_TMP Predict(
325 const ae2f_float_t*
const prm_in
327 ae2f_float_t*
const out
333inline void ae2f_TMP Follow(
336 const ae2f_float_t*
const prm_in
338 const ae2f_float_t*
const delta
344inline void ae2f_TMP Fit(
346 ,
ae2f_LP(_this::inc)
const ae2f_float_t*
const prm_inp
347 ,
ae2f_LP(_this::outc)
const ae2f_float_t*
const prm_out
348 ,
ae2f_LP(_this::outc)
const ae2f_float_t*
const prm_out_desired
351 ae2f_AnnSlpFit(reterr_opt,
this, prm_inp, prm_out, prm_out_desired);
354inline void ae2f_TMP Train(
356 ,
ae2f_LP(slp::inc)
const ae2f_float_t* inp
357 ,
ae2f_LP(slp::outc)
const ae2f_float_t* out_desired
#define ae2f_structdef(key, name)
#define ae2f_reinterpret_cast(t, v)
#define unless(...)
Invokes when condition is false.
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
#define ae2f_WhenCXX(...)
Appears when the current language is C.
#define ae2f_NONE
Literally nothing.
#define ae2f_errGlob_ALLOC_FAILED
stdlib allocating functions (malloc, calloc, realloc) has been failed.
uint8_t ae2f_err_t
Informs that this number represents the error.
#define ae2f_errGlob_PTR_IS_NULL
Failed to refer the pointer either l-value inside the function.
#define __ae2f_MACRO_GENERATED
#define __ae2f_AnnMlpSz_imp(ret_sz, outc, weightc, depth, szswap, act, actderiv, deltastream, outcache, weight, bias)
#define __ae2f_AnnMlpBwd_imp(v_tmp, v_send, slp_then, retdelta_then, deltaseed, actderiv_then, inp)
delta to delta
#define __ae2f_AnnMlpHidDeltaSingle_imp(v_single, slp, weight, delta, iidx)
#define __ae2f_AnnMlpPredictStream_imp(v_predict, mlp, inp, out, sz, weight, bias, outcache, act_opt)
#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.
#define __ae2f_AnnMlpInitWithOutSz_imp(v_mlp, v_init, depth, outsz, weightsz, szvector, szswap_opt, act, actderiv, lossderiv, deltastream, outcache, weight, bias, learningrate, learningrate_bias)
#define __ae2f_AnnMlpTrainPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out, out_desired)
#define __ae2f_AnnMlpFollowPrimal_imp(OPER_NEG, OPER_NONE, v_follow, mlp, inp, delta, lenv, outstream, deltacache, weight, bias, learningrate, learningrate_bias, actderiv)
#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
#define __ae2f_AnnMlpTrainAutoPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out_desired)
#define __ae2f_AnnMlpPredictPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, out)
#define __ae2f_AnnMlpFollowPrimal(OPER_NEG, OPER_NONE, reterr, mlp, inp, delta)
#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)
#define __ae2f_AnnSlpFollow_imp(reg_follow, prm_slp, pprm_in, pprm_delta, ptr_weight, ptr_bias, prm_learningrate, prm_learningrate_bias)
#define __ae2f_AnnSlpFit_C(...)
#define __ae2f_AnnSlpFollow_C(...)
#define __ae2f_AnnSlpFetchDelta_imp(tmp_delta, prm_slp, pprm_out, pprm_out_desired, fn_actderiv, fn_lossderiv, pret_delta)
#define __ae2f_AnnSlpFetchDelta_C(...)
#define __ae2f_AnnSlpDel_C
#define __ae2f_AnnSlpTrain_C
#define __ae2f_AnnSlpInit_C
#define __ae2f_AnnSlpPredict_imp(reg_predict, prmreg_slp, pprm_in, ret, ptr_outcache, pprm_weight, pprm_bias, fn_act)
#define __ae2f_AnnSlpMk_C
#define __ae2f_AnnSlpPredict_C(...)
#define ae2f_AnnSlpPredict
#define ae2f_AnnSlpFollow