Skip to content

Commit 0433b37

Browse files
Add an Stop_training attribute
1 parent c71745c commit 0433b37

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/TensorFlowNET.Core/Keras/Engine/IModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ Tensors predict(Tensors x,
7979

8080
IKerasConfig get_config();
8181

82-
void set_stopTraining_true();
82+
bool Stop_training { get;set; }
8383
}

src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void on_epoch_end(int epoch, Dictionary<string, float> epoch_logs)
9595
if (_wait >= _paitence && epoch > 0)
9696
{
9797
_stopped_epoch = epoch;
98-
_parameters.Model.set_stopTraining_true();
98+
_parameters.Model.Stop_training = true;
9999
if (_restore_best_weights && _best_weights != null)
100100
{
101101
if (_verbose > 0)

src/TensorFlowNET.Keras/Engine/Model.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public IOptimizer Optimizer
3939
set => optimizer = value;
4040
}
4141

42+
public bool Stop_training
43+
{
44+
get => stop_training;
45+
set => stop_training = value;
46+
}
47+
4248
public Model(ModelArgs args)
4349
: base(args)
4450
{
@@ -145,10 +151,5 @@ public override IDictionary<string, Trackable> _trackable_children(SaveType save
145151
return children;
146152
}
147153

148-
149-
void IModel.set_stopTraining_true()
150-
{
151-
stop_training = true;
152-
}
153154
}
154155
}

0 commit comments

Comments
 (0)