From 5762e2c1bb4f7f6253d590bcb97c9b7c06ca94cb Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Mon, 16 Sep 2019 14:55:45 -0400 Subject: [PATCH] functions/Buffer: Remove redundant parameter checks. The checks were as(more) expensive than the computation, removing them gives ~7-9% performance improvement. Signed-off-by: Jan Vesely --- .../functions/statefulfunctions/memoryfunctions.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/psyneulink/core/components/functions/statefulfunctions/memoryfunctions.py b/psyneulink/core/components/functions/statefulfunctions/memoryfunctions.py index 8a312d0cbe9..6eb40c5511a 100644 --- a/psyneulink/core/components/functions/statefulfunctions/memoryfunctions.py +++ b/psyneulink/core/components/functions/statefulfunctions/memoryfunctions.py @@ -334,10 +334,7 @@ def _function(self, # Apply rate and/or noise, if they are specified, to all stored items if len(previous_value): - if any(np.atleast_1d(rate) != 1.0): - previous_value = previous_value * rate - if any(np.atleast_1d(noise) != 0.0): - previous_value = previous_value + noise + previous_value = previous_value * rate + noise previous_value = deque(previous_value, maxlen=self.parameters.history._get(context))