diff --git a/src/mlpack/methods/ann/layer/alpha_dropout_impl.hpp b/src/mlpack/methods/ann/layer/alpha_dropout_impl.hpp index 5b76b587ba..91a150f410 100644 --- a/src/mlpack/methods/ann/layer/alpha_dropout_impl.hpp +++ b/src/mlpack/methods/ann/layer/alpha_dropout_impl.hpp @@ -129,7 +129,9 @@ void AlphaDropoutType::serialize( ar(CEREAL_NVP(b)); // No need to serialize the mask, since it will be recomputed on the next - // forward pass. + // forward pass. But we should clear it if we are loading. + if (Archive::is_loading::value) + mask.clear(); } } // namespace ann