Browse Source

Fix model.evaluate don't have output

tags/v0.100.5-BERT-load
wangdapao666 Haiping 2 years ago
parent
commit
544ff9125b
2 changed files with 3 additions and 1 deletions
  1. +1
    -0
      src/TensorFlowNET.Core/Keras/Engine/ICallback.cs
  2. +2
    -1
      src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs

+ 1
- 0
src/TensorFlowNET.Core/Keras/Engine/ICallback.cs View File

@@ -13,5 +13,6 @@ public interface ICallback
void on_predict_batch_end(long end_step, Dictionary<string, Tensors> logs); void on_predict_batch_end(long end_step, Dictionary<string, Tensors> logs);
void on_predict_end(); void on_predict_end();
void on_test_begin(); void on_test_begin();
void on_test_batch_begin(long step);
void on_test_batch_end(long end_step, IEnumerable<(string, Tensor)> logs); void on_test_batch_end(long end_step, IEnumerable<(string, Tensor)> logs);
} }

+ 2
- 1
src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs View File

@@ -72,12 +72,13 @@ namespace Tensorflow.Keras.Engine


foreach (var step in data_handler.steps()) foreach (var step in data_handler.steps())
{ {
callbacks.on_train_batch_begin(step);
callbacks.on_test_batch_begin(step);
logs = test_function(data_handler, iterator); logs = test_function(data_handler, iterator);
var end_step = step + data_handler.StepIncrement; var end_step = step + data_handler.StepIncrement;
callbacks.on_test_batch_end(end_step, logs); callbacks.on_test_batch_end(end_step, logs);
} }
} }
Console.WriteLine();
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
} }


Loading…
Cancel
Save