Softmax + Categorical Crossentropy

I fixed the activation+loss function, you can't select it directly, it automaticly uses it if it can. I also fixed one-hot generator. Still haven't tested the activation + loss nor any other backward function. I'll do that when I get to the optimizers which is next.
This commit is contained in:
2026-08-06 09:53:03 +02:00
parent fecb4c70b1
commit 642bba1198
18 changed files with 627 additions and 378 deletions
+11 -31
View File
@@ -134,18 +134,13 @@
// Expands to:
// #pragma omp parallel for if(condition)
// num_threads(PANIC_OMP_NUM_THREADS)
// schedule(static)
// reduction(operation:variable)
//
// Runs the loop in parallel only when condition is true.
// Each thread receives a private copy of variable.
// Afterward, OpenMP combines those copies using operation.
// schedule(static) assigns fixed groups of iterations to each thread.
#define PANIC_OMP_PARALLEL_FOR_REDUCTION_IF(condition, operation, variable) \
_Pragma(PANIC_STRINGIFY(omp parallel for if(condition) \
num_threads(PANIC_OMP_NUM_THREADS) \
schedule(static) \
reduction(operation:variable)))
_Pragma(PANIC_STRINGIFY(omp parallel for if(condition) reduction(operation:variable) num_threads(PANIC_OMP_NUM_THREADS)))
#else
@@ -165,19 +160,13 @@
_Pragma(PANIC_STRINGIFY(omp parallel for if(condition)))
// Expands to:
// #pragma omp parallel for if(condition)
// num_threads(PANIC_OMP_NUM_THREADS)
// schedule(static)
// reduction(operation:variable)
// #pragma omp parallel for if(condition) reduction(operation:variable)
//
// Runs the loop in parallel only when condition is true.
// Each thread receives a private copy of variable.
// Afterward, OpenMP combines those copies using operation.
// schedule(static) assigns fixed groups of iterations to each thread.
#define PANIC_OMP_PARALLEL_FOR_REDUCTION_IF(condition, operation, variable) \
_Pragma(PANIC_STRINGIFY(omp parallel for if(condition) \
schedule(static) \
reduction(operation:variable)))
_Pragma(PANIC_STRINGIFY(omp parallel for if(condition) reduction(operation:variable)))
#endif
@@ -199,25 +188,16 @@
// }
//
// That means the same code still works on microcontrollers and non-OpenMP builds.
// Without OpenMP, the normal for-loop remains.
#define PANIC_OMP_PARALLEL_FOR
// Check that condition is syntactically valid, but do not evaluate it.
#define PANIC_OMP_PARALLEL_FOR_IF(condition) static_cast<void>(sizeof(condition));
// The operation and variable are only needed by the OpenMP pragma.
// The serial loop itself performs the calculation normally.
#define PANIC_OMP_PARALLEL_FOR_REDUCTION_IF(condition, operation, variable) static_cast<void>(sizeof(condition));
#endif
//---------------------------------------------------------------------------------------------------------------------------
// TYPE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// None.
//---------------------------------------------------------------------------------------------------------------------------
// VARIABLE DESCRIPTION
//---------------------------------------------------------------------------------------------------------------------------
// None.
//---------------------------------------------------------------------------------------------------------------------------
// FUNCTION PROTOTYPE
//---------------------------------------------------------------------------------------------------------------------------
// None.