diff --git a/bgflow/distribution/distributions.py b/bgflow/distribution/distributions.py index 6bd4dd7c..d228d081 100644 --- a/bgflow/distribution/distributions.py +++ b/bgflow/distribution/distributions.py @@ -90,9 +90,13 @@ def __getattr__(self, name): try: return super().__getattr__(name=name) except AttributeError: - uniform = _SloppyUniform(self.low, self.high, self.validate_args, tol=self.tol) - if hasattr(uniform, name): - return getattr(uniform, name) + # workaround so that AttributeError is always raised on low and high so that buffers are registered + if name == 'low' or name == 'high': + raise AttributeError(f"SloppyUniform has no attribute {name}") + else: + uniform = _SloppyUniform(self.low, self.high, self.validate_args, tol=self.tol) + if hasattr(uniform, name): + return getattr(uniform, name) except: raise AttributeError(f"SloppyUniform has no attribute {name}")