From bf9c40e13c55b6b8489ec91aa68d79d9fa039149 Mon Sep 17 00:00:00 2001 From: Marek Otahal Date: Wed, 2 Sep 2020 22:21:44 +0200 Subject: [PATCH] SP serialization fix: added missing fields version_ boostedOverlaps_ minActiveDutyCycles_ thanks @N3rv0us, @pmenn36 and everyone who investigated the issue. For issue #874 --- src/htm/algorithms/SpatialPooler.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/htm/algorithms/SpatialPooler.hpp b/src/htm/algorithms/SpatialPooler.hpp index f1d662d69e..017baae821 100644 --- a/src/htm/algorithms/SpatialPooler.hpp +++ b/src/htm/algorithms/SpatialPooler.hpp @@ -300,13 +300,19 @@ class SpatialPooler : public Serializable CEREAL_NVP(synPermBelowStimulusInc_), CEREAL_NVP(synPermConnected_), CEREAL_NVP(minPctOverlapDutyCycles_), - CEREAL_NVP(wrapAround_)); + CEREAL_NVP(wrapAround_), + CEREAL_NVP(version_) + ); ar(CEREAL_NVP(boostFactors_)); ar(CEREAL_NVP(overlapDutyCycles_)); ar(CEREAL_NVP(activeDutyCycles_)); ar(CEREAL_NVP(minOverlapDutyCycles_)); ar(CEREAL_NVP(connections_)); ar(CEREAL_NVP(rng_)); + ar(CEREAL_NVP(minActiveDutyCycles_)); + ar(CEREAL_NVP(boostedOverlaps_)); //boostedOverlaps_ are re-created in each compute() + //...but if deserialized SP does some other action, it may get out of order. + } // FOR Cereal Deserialization template @@ -334,16 +340,17 @@ class SpatialPooler : public Serializable CEREAL_NVP(synPermBelowStimulusInc_), CEREAL_NVP(synPermConnected_), CEREAL_NVP(minPctOverlapDutyCycles_), - CEREAL_NVP(wrapAround_)); + CEREAL_NVP(wrapAround_), + CEREAL_NVP(version_) + ); ar(CEREAL_NVP(boostFactors_)); ar(CEREAL_NVP(overlapDutyCycles_)); ar(CEREAL_NVP(activeDutyCycles_)); ar(CEREAL_NVP(minOverlapDutyCycles_)); ar(CEREAL_NVP(connections_)); ar(CEREAL_NVP(rng_)); - - // initialize ephemeral members - boostedOverlaps_.resize(numColumns_); + ar(CEREAL_NVP(minActiveDutyCycles_)); + ar(CEREAL_NVP(boostedOverlaps_)); } /**