Skip to content

Commit 5c53b2e

Browse files
committed
use runtimeerror instead of assert
1 parent 559b98d commit 5c53b2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bayesflow/links/ordered.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def __init__(self, axis: int, anchor_index: int, **kwargs):
1212
super().__init__(**keras_kwargs(kwargs))
1313
self.axis = axis
1414
self.anchor_index = anchor_index
15+
self.group_indices = None
1516

1617
self.config = {"axis": axis, "anchor_index": anchor_index, **kwargs}
1718

@@ -22,9 +23,9 @@ def get_config(self):
2223
def build(self, input_shape):
2324
super().build(input_shape)
2425

25-
assert self.anchor_index % input_shape[self.axis] != 0 and self.anchor_index != -1, (
26-
"anchor should not be first or last index."
27-
)
26+
if self.anchor_index % input_shape[self.axis] != 0 and self.anchor_index != -1:
27+
raise RuntimeError("Anchor should not be first or last index.")
28+
2829
self.group_indices = dict(
2930
below=list(range(0, self.anchor_index)),
3031
above=list(range(self.anchor_index + 1, input_shape[self.axis])),

0 commit comments

Comments
 (0)