From acf95c7c98ceb67ac8511d6058813721277d6866 Mon Sep 17 00:00:00 2001 From: Tomasz Sobczyk Date: Thu, 24 Dec 2020 13:30:04 +0100 Subject: [PATCH] Accumulate clipping statistics to a 64 bit integer to prevent overflow for larger batch sizes. --- src/nnue/trainer/trainer_clipped_relu.h | 6 ++---- src/nnue/trainer/trainer_feature_transformer.h | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/nnue/trainer/trainer_clipped_relu.h b/src/nnue/trainer/trainer_clipped_relu.h index ff883afc..48dec8be 100644 --- a/src/nnue/trainer/trainer_clipped_relu.h +++ b/src/nnue/trainer/trainer_clipped_relu.h @@ -295,8 +295,6 @@ namespace Eval::NNUE { // number of samples in mini-batch IndexType batch_size_; - IndexType num_total_; - const LearnFloatType* input_; // Trainer of the previous layer @@ -316,8 +314,8 @@ namespace Eval::NNUE { // Health check statistics LearnFloatType min_activations_[kOutputDimensions]; LearnFloatType max_activations_[kOutputDimensions]; - IndexType num_clipped_; - IndexType num_total_; + uint64_t num_clipped_; + uint64_t num_total_; ThreadState() { reset(); } diff --git a/src/nnue/trainer/trainer_feature_transformer.h b/src/nnue/trainer/trainer_feature_transformer.h index 0915ccca..b0e0ebba 100644 --- a/src/nnue/trainer/trainer_feature_transformer.h +++ b/src/nnue/trainer/trainer_feature_transformer.h @@ -690,8 +690,6 @@ namespace Eval::NNUE { // layer to learn LayerType* const target_layer_; - IndexType num_total_; - // parameter alignas(kCacheLineSize) LearnFloatType biases_[kHalfDimensions]; alignas(kCacheLineSize) @@ -717,8 +715,8 @@ namespace Eval::NNUE { alignas(kCacheLineSize) LearnFloatType max_activations_[kHalfDimensions]; LearnFloatType min_pre_activation_; LearnFloatType max_pre_activation_; - IndexType num_clipped_; - IndexType num_total_; + uint64_t num_clipped_; + uint64_t num_total_; ThreadStatState() { reset(); }