From d5e9684faab2bba6bcd6db7201597fc9cddf0bc1 Mon Sep 17 00:00:00 2001 From: Katherine Mantel Date: Fri, 4 Nov 2022 19:14:29 -0400 Subject: [PATCH] DictionaryMemory: reset: handle empty previous_value --- .../core/components/functions/stateful/memoryfunctions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/psyneulink/core/components/functions/stateful/memoryfunctions.py b/psyneulink/core/components/functions/stateful/memoryfunctions.py index 32e58130ea0..b516a9b6c90 100644 --- a/psyneulink/core/components/functions/stateful/memoryfunctions.py +++ b/psyneulink/core/components/functions/stateful/memoryfunctions.py @@ -23,6 +23,7 @@ """ +import copy import numbers import warnings from collections import deque @@ -2541,8 +2542,8 @@ def reset(self, previous_value=None, context=None): previous_value = self._get_current_parameter_value("initializer", context) if previous_value == []: - self.parameters.previous_value._get(context).clear() value = np.ndarray(shape=(2, 0, len(self.defaults.variable[0]))) + self.parameters.previous_value._set(copy.deepcopy(value), context) else: value = self._initialize_previous_value(previous_value, context=context)