Skip to content

Commit

Permalink
fix fann_train_on_file and fann_cascadetrain_on_file to set at least …
Browse files Browse the repository at this point in the history
…ann->errno_f if reading training data from file failed
  • Loading branch information
jjYBdx4IL authored and jjYBdx4IL committed Jun 17, 2016
1 parent d71d547 commit 36ad59b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/steepness_train.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ void train_on_steepness_file(struct fann *ann, char *filename,
unsigned int i;

struct fann_train_data *data = fann_read_train_from_file(filename);
if(data == NULL)
{
ann->errno_f = FANN_E_CANT_READ_TD;
return;
}

if(epochs_between_reports)
{
Expand Down
1 change: 1 addition & 0 deletions src/fann_cascade.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ FANN_EXTERNAL void FANN_API fann_cascadetrain_on_file(struct fann *ann, const ch

if(data == NULL)
{
ann->errno_f = FANN_E_CANT_READ_TD;
return;
}
fann_cascadetrain_on_data(ann, data, max_neurons, neurons_between_reports, desired_error);
Expand Down
1 change: 1 addition & 0 deletions src/fann_train_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, const char *fil

if(data == NULL)
{
ann->errno_f = FANN_E_CANT_READ_TD;
return;
}
fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error);
Expand Down

0 comments on commit 36ad59b

Please sign in to comment.