diff --git a/src/TensorFlowNET.Core/Keras/Engine/IModel.cs b/src/TensorFlowNET.Core/Keras/Engine/IModel.cs index 3928ef5f9..6b2eb1863 100644 --- a/src/TensorFlowNET.Core/Keras/Engine/IModel.cs +++ b/src/TensorFlowNET.Core/Keras/Engine/IModel.cs @@ -79,5 +79,5 @@ Tensors predict(Tensors x, IKerasConfig get_config(); - void set_stopTraining_true(); + bool Stop_training { get;set; } } diff --git a/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs b/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs index 1e0418dc5..13db771d3 100644 --- a/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs +++ b/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs @@ -95,7 +95,7 @@ public void on_epoch_end(int epoch, Dictionary epoch_logs) if (_wait >= _paitence && epoch > 0) { _stopped_epoch = epoch; - _parameters.Model.set_stopTraining_true(); + _parameters.Model.Stop_training = true; if (_restore_best_weights && _best_weights != null) { if (_verbose > 0) diff --git a/src/TensorFlowNET.Keras/Engine/Model.cs b/src/TensorFlowNET.Keras/Engine/Model.cs index c1d29f592..7d4640af1 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.cs @@ -39,6 +39,12 @@ public IOptimizer Optimizer set => optimizer = value; } + public bool Stop_training + { + get => stop_training; + set => stop_training = value; + } + public Model(ModelArgs args) : base(args) { @@ -145,10 +151,5 @@ public override IDictionary _trackable_children(SaveType save return children; } - - void IModel.set_stopTraining_true() - { - stop_training = true; - } } }