cbasedann/neurons.c

19 lines
No EOL
422 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "neurons.h"
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);
}