libfann / fann

Official github repository for Fast Artificial Neural Network Library (FANN)
GNU Lesser General Public License v2.1
1.59k stars 380 forks source link

Maybe a bug ? #108

Closed mingodad closed 5 years ago

mingodad commented 6 years ago

Hello ! Doing a code revision on fann source code I found this:

FANN_EXTERNAL void FANN_API fann_scale_input( struct fann *ann, fann_type *input_vector )
{
    unsigned cur_neuron;
    if(ann->scale_mean_in == NULL)
    {
        fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
        return;
    }
...
FANN_EXTERNAL void FANN_API fann_descale_input( struct fann *ann, fann_type *input_vector )
{
    unsigned cur_neuron;
    if(ann->scale_mean_in == NULL)
    {
        fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
        return;
    }

And this probable copy & paste mistake:

FANN_EXTERNAL void FANN_API fann_scale_output( struct fann *ann, fann_type *output_vector )
{
    unsigned cur_neuron;
    if(ann->scale_mean_in == NULL) <<<<<????? copy&paste mistake ?????? scale_mean_out
    {
        fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
        return;
    }
...
FANN_EXTERNAL void FANN_API fann_descale_output( struct fann *ann, fann_type *output_vector )
{
    unsigned cur_neuron;
    if(ann->scale_mean_in == NULL) <<<<<????? copy&paste mistake ?????? scale_mean_out
    {
        fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
        return;
    }

Cheers !

troiganto commented 6 years ago

Hi @mingodad, thanks for your bug report! I've had a look into this and your point seems reasonable (although the current code doesn't cause any issues per se). Hence, I've made a pull request to incorporate your suggestion. It should be linked right above this comment.