From d5c707c9253eaa36387f4e0f457ea791f31a6b65 Mon Sep 17 00:00:00 2001 From: neworderofjamie Date: Thu, 30 Sep 2021 10:14:13 +0100 Subject: [PATCH] throw exceptions if GeNNModel ``use_backend``, ``timing_enabled`` and ``batch_size`` properties are set after model is built --- pygenn/genn_model.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pygenn/genn_model.py b/pygenn/genn_model.py index 409ba51a3b..fab3c70ff0 100644 --- a/pygenn/genn_model.py +++ b/pygenn/genn_model.py @@ -194,6 +194,9 @@ def use_backend(self): @use_backend.setter def use_backend(self, backend): + if self._built: + raise Exception("GeNN model already built") + # If no backend is specified if backend is None: # Check we have managed to import any bagenn_wrapperckends @@ -212,6 +215,9 @@ def timing_enabled(self): @timing_enabled.setter def timing_enabled(self, timing): + if self._built: + raise Exception("GeNN model already built") + self._model.set_timing(timing) @property @@ -220,6 +226,9 @@ def batch_size(self): @batch_size.setter def batch_size(self, batch_size): + if self._built: + raise Exception("GeNN model already built") + self._model.set_batch_size(batch_size) @property