AIfES 2  2.0.0
aicore_losstype Struct Reference

Type indicator of the loss to check for the loss type. More...

#include <aifes_core.h>

Data Fields

const char * name
 Name of the loss type (for example "Mean Squared Error")
 
void(* print_specs )(const ailoss_t *self)
 Set a function to print specs of the loss. More...
 

Detailed Description

Type indicator of the loss to check for the loss type.

Every loss should have a constant global variable of this type which indicates the loss type.
Example for the mse loss:

const aicore_losstype_t ailoss_mse_type_s = {
#ifdef AIDEBUG_PRINT_MODULE_SPECS
.name = "Mean Squared Error",
.print_specs = ailoss_mse_print_spec
#else
.name = 0,
.print_specs = 0
#endif
};
const aicore_losstype_t *ailoss_mse_type = &ailoss_mse_type_s;
const aicore_losstype_t * ailoss_mse_type
Mean Squared Error loss type.
Type indicator of the loss to check for the loss type.
Definition: aifes_core.h:121
const char * name
Name of the loss type (for example "Mean Squared Error")
Definition: aifes_core.h:122

Checks for the loss type can look like this:

ailoss_t *example_loss;
if(example_loss->loss_type == ailoss_mse_type){
...
}
AIfES loss interface.
Definition: aifes_core.h:385
const aicore_losstype_t * loss_type
Type of the loss (for example ailoss_mse_type)
Definition: aifes_core.h:386

Field Documentation

◆ print_specs

void(* print_specs) (const ailoss_t *self)

Set a function to print specs of the loss.

This function should only be set in the debug mode when prints are required (to save memory otherwise)

Parameters
selfThe loss
*printA function for printing (for example printf)

The documentation for this struct was generated from the following file: