|
99 | 99 | #define MSG12 |
100 | 100 | #define MSG13 |
101 | 101 | #define MSG14 |
| 102 | +#define MSG15 |
102 | 103 | #define LOVE \n 𝖀𝖓𝖈𝖔𝖓𝖉𝖎𝖙𝖎𝖔𝖓𝖆𝖑 𝕷𝖔𝖛𝖊 |
103 | 104 |
|
104 | 105 | #define F_MACRO |
|
149 | 150 | #if ((_1_OPTIMIZE bitor 0B11111011) == 0B11111111) |
150 | 151 | #define REDUCE_RAM_STATIC_REFERENCE |
151 | 152 | #undef MSG5 |
152 | | - #define MSG5 \n- " [1] 0B00000100 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Be careful with multiple NN objects." |
| 153 | + #define MSG5 \n- " [1] 0B00000100 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] If multiple NN objects, see: _2_OPTIMIZE 0B00000010!" |
153 | 154 | #endif |
154 | 155 |
|
155 | 156 | #if ((_1_OPTIMIZE bitor 0B11111101) == 0B11111111) |
|
283 | 284 |
|
284 | 285 | #define CAST_TO_LLONG_IF_NOT_INT_QUANTIZATION(value) value |
285 | 286 | #endif |
| 287 | + |
| 288 | + #if ((_2_OPTIMIZE bitor 0B11111101) == 0B11111111) |
| 289 | + #undef MSG15 |
| 290 | + #if defined(REDUCE_RAM_STATIC_REFERENCE) |
| 291 | + #error "You don't have to define both _1_ 0B00000100 (REDUCE_RAM_STATIC_REFERENCE) and _2_ 0B00000010 (REDUCE_RAM_STATIC_REFERENCE_FOR_MULTIPLE_NN_OBJECTS)." |
| 292 | + #endif |
| 293 | + #define MSG15 \n- " [2] 0B00000010 [ⓘ] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] If single NN object, use: _1_OPTIMIZE 0B00000100 instead." |
| 294 | + #define REDUCE_RAM_STATIC_REFERENCE |
| 295 | + #define REDUCE_RAM_STATIC_REFERENCE_FOR_MULTIPLE_NN_OBJECTS |
| 296 | + #endif |
286 | 297 | #endif |
287 | 298 |
|
288 | 299 | // Disable SIMD parallel processing if double-precision or int-quntization is enabled |
|
757 | 768 | #define STR_HELPER(x) #x |
758 | 769 | #define STR(x) STR_HELPER(x) |
759 | 770 |
|
760 | | -#define INFORMATION LOVE __NN_VERSION__ MSG0 MSG1 MSG2 MSG3 MSG4 MSG5 MSG6 MSG7 MSG8 MSG9 MSG10 MSG11 MSG12 MSG13 MSG14 \n\n 𝗨𝗦𝗜𝗡𝗚 [ƒx] AL A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 CSTA CA1 CA2 CA3 CA4 CA5 |~|\n\n NB A9 A10 A11 A12 A13 A14 NB_CA1 NB_CA2 NB_CA3 NB_CA4 NB_CA5 |
| 771 | +#define INFORMATION LOVE __NN_VERSION__ MSG0 MSG1 MSG2 MSG3 MSG4 MSG5 MSG6 MSG7 MSG8 MSG9 MSG10 MSG11 MSG12 MSG13 MSG14 MSG15 \n\n 𝗨𝗦𝗜𝗡𝗚 [ƒx] AL A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 CSTA CA1 CA2 CA3 CA4 CA5 |~|\n\n NB A9 A10 A11 A12 A13 A14 NB_CA1 NB_CA2 NB_CA3 NB_CA4 NB_CA5 |
761 | 772 | #pragma message( STR(INFORMATION) ) |
762 | 773 |
|
763 | 774 | // i might change static variables to plain variables and just pass a pointer from outer class? |
@@ -1295,6 +1306,9 @@ class NeuralNetwork |
1295 | 1306 |
|
1296 | 1307 | DFLOAT *NeuralNetwork::FeedForward_Individual(const DFLOAT &input) |
1297 | 1308 | { |
| 1309 | + #if defined(REDUCE_RAM_STATIC_REFERENCE_FOR_MULTIPLE_NN_OBJECTS) |
| 1310 | + me = this; |
| 1311 | + #endif |
1298 | 1312 | #if defined(USE_PROGMEM) |
1299 | 1313 | layers[0].FdF_Individual_PROGMEM(input, Individual_Input); |
1300 | 1314 | #elif defined(USE_INTERNAL_EEPROM) |
@@ -1378,6 +1392,10 @@ class NeuralNetwork |
1378 | 1392 | DFLOAT *NeuralNetwork::FeedForward(const DFLOAT *inputs) |
1379 | 1393 | { |
1380 | 1394 | _inputs = inputs; |
| 1395 | + |
| 1396 | + #if defined(REDUCE_RAM_STATIC_REFERENCE_FOR_MULTIPLE_NN_OBJECTS) |
| 1397 | + me = this; |
| 1398 | + #endif |
1381 | 1399 |
|
1382 | 1400 | #if defined(REDUCE_RAM_DELETE_OUTPUTS) |
1383 | 1401 | if (FIRST_TIME_FDFp == true) // is it the first time ? if not, then delete trashes |
@@ -1445,6 +1463,10 @@ class NeuralNetwork |
1445 | 1463 | #endif |
1446 | 1464 | */ |
1447 | 1465 |
|
| 1466 | + #if defined(REDUCE_RAM_STATIC_REFERENCE_FOR_MULTIPLE_NN_OBJECTS) |
| 1467 | + me = this; |
| 1468 | + #endif |
| 1469 | + |
1448 | 1470 | layers[numberOflayers - 1].BackPropOutput(expected, layers[numberOflayers - 2].outputs); // issue because backprop einai anapoda ta weights [Fixed] |
1449 | 1471 |
|
1450 | 1472 | for (int i = numberOflayers - 2; i > 0; i--) |
|
0 commit comments