AIfES 2  2.0.0
ailoss_crossentropy.h
Go to the documentation of this file.
1 
50 #ifndef CROSSENTROPY_LOSS
51 #define CROSSENTROPY_LOSS
52 
53 #include "core/aifes_core.h"
56 
70 
78  void (*tensor_sub)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result);
79 
95  void (*crossentropy)(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result);
96 
102  void (*scale_by_batch_size)(const aitensor_t *predicted_data, aitensor_t *result);
103 
105 };
106 
113 
126 
152 void ailoss_crossentropy_calc_delta(ailoss_t *self, const aitensor_t *target_data);
153 
184 void ailoss_crossentropy_calc_loss(ailoss_t *self, const aitensor_t *target_data, void *result);
185 
199 
200 #ifdef AIDEBUG_PRINT_MODULE_SPECS
206 #endif // AIDEBUG_PRINT_MODULE_SPECS
207 
208 #endif // CROSSENTROPY_LOSS
AIfES 2 core interface.
Base layer implementation of the Sigmoid activation layer.
Base layer implementation of the Softmax activation layer.
ailoss_t * ailoss_crossentropy(ailoss_crossentropy_t *loss, ailayer_t *input_layer)
Initialize and connect the given Cross-Entropy loss.
void ailoss_crossentropy_calc_delta(ailoss_t *self, const aitensor_t *target_data)
Calculate the combined derivative of the given Cross-Entropy loss and the output layer for error back...
void ailoss_crossentropy_dummy_backward(ailayer_t *self)
Dummy backward-function for the output layer of the model.
const aicore_losstype_t * ailoss_crossentropy_type
Cross-Entropy loss type.
void ailoss_crossentropy_calc_loss(ailoss_t *self, const aitensor_t *target_data, void *result)
Calculate the Cross-Entropy loss on the given target data.
void ailoss_crossentropy_print_specs(const ailoss_t *self)
Print the loss specification.
Type indicator of the loss to check for the loss type.
Definition: aifes_core.h:121
AIfES layer interface.
Definition: aifes_core.h:252
General Cross-Entropy loss struct.
Definition: ailoss_crossentropy.h:62
void(* tensor_sub)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Required math function: Element wise tensor subtraction.
Definition: ailoss_crossentropy.h:78
void(* scale_by_batch_size)(const aitensor_t *predicted_data, aitensor_t *result)
Required math function: Scaling of the gradient tensor.
Definition: ailoss_crossentropy.h:102
const aimath_dtype_t * dtype
Main data type of the loss.
Definition: ailoss_crossentropy.h:64
void(* crossentropy)(const aitensor_t *predicted_data, const aitensor_t *target_data, void *result)
Required math function: Cross-Entropy between two tensors.
Definition: ailoss_crossentropy.h:95
ailoss_t base
Inherited field members from general ailoss struct.
Definition: ailoss_crossentropy.h:63
AIfES loss interface.
Definition: aifes_core.h:385
Indicator for the used datatype.
Definition: aifes_math.h:44
A tensor in AIfES.
Definition: aifes_math.h:89