Updating/Adding functions

Cette révision appartient à :
Abdel Kader Chabi Sika Boni 2021-11-27 11:16:46 +01:00
Parent f716f8badb
révision ce66110173
2 fichiers modifiés avec 15 ajouts et 3 suppressions

Voir le fichier

@ -3,8 +3,17 @@
#include <string.h>
#include "neurons.h"
Neuron *init_neuron()
Neuron *init_neuron(int n_weights)
{
Neuron *neuron = (Neuron*)malloc(sizeof(Neuron));
neuron->weights = (float*)malloc(n_weights*sizeof(float));
neuron->output = 0.0;
neuron->delta_error = 0.0;
neuron->same_layer_next_neuron = NULL;
}
void destroy_neuron(Neuron *neuron)
{
free(neuron->weights);
free(neuron);
}

Voir le fichier

@ -4,11 +4,14 @@
typedef struct neuron Neuron;
struct neuron
{
float output; //output of the neuron
float *weights; //weights associated to the neuron + neuron's bias
float output; //output of the neuron
float delta_error; //the delta error for updating current weights
Neuron *same_layer_next_neuron;
};
Neuron *init_neuron(int n_weights);
void destroy_neuron(Neuron *neuron);
#endif