Генерация Си кода из нейросетей
Автор
#include <stdio.h>
#include <stdbool.h>
float ifelse(bool cond, float a, float b) { return cond ? a : b; }
#include <math.h>
void neural_net(float* y, const float* x) {
y[0] = ifelse(20.0f + 10.0f * x[0] < 0, 0, 20.0f + 10.0f * x[0]);
}
int main(int argc, char const *argv[]){
float out[1];
float in[] = {3.1415};
neural_net( out, in );
printf( "%f\n", out[0] );
return 0;
}