Skip to content

Commit a91e358

Browse files
authored
Merge pull request #1171 from asaf92/patch-1
fix: model does not stop on stop_training == true #1170
2 parents 179c3f0 + 1142828 commit a91e358

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/TensorFlowNET.Keras/Engine/Model.Fit.cs

+12
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ History FitInternal(DataHandler data_handler, int epochs, int validation_step, i
224224

225225
GC.Collect();
226226
GC.WaitForPendingFinalizers();
227+
if (stop_training)
228+
{
229+
break;
230+
}
227231
}
228232

229233
return callbacks.History;
@@ -283,6 +287,10 @@ History FitInternal(DataHandler data_handler, int epochs, int verbose, List<ICal
283287

284288
GC.Collect();
285289
GC.WaitForPendingFinalizers();
290+
if (stop_training)
291+
{
292+
break;
293+
}
286294
}
287295

288296
return callbacks.History;
@@ -339,6 +347,10 @@ History FitInternal(DataHandler data_handler, int epochs, int verbose, List<ICal
339347

340348
GC.Collect();
341349
GC.WaitForPendingFinalizers();
350+
if (stop_training)
351+
{
352+
break;
353+
}
342354
}
343355

344356
return callbacks.History;

0 commit comments

Comments
 (0)