Skip to content

Commit cb3fc61

Browse files
committed
remove width and depth argument in MLP
1 parent 0564092 commit cb3fc61

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

bayesflow/networks/mlp/mlp.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ class MLP(keras.Layer):
2020

2121
def __init__(
2222
self,
23+
widths: Sequence[int],
2324
*,
24-
depth: int = None,
25-
width: int = None,
26-
widths: Sequence[int] = None,
2725
activation: str = "mish",
2826
kernel_initializer: str = "he_normal",
2927
residual: bool = False,
@@ -46,15 +44,8 @@ def __init__(
4644
4745
Parameters
4846
----------
49-
depth : int, optional
50-
Number of layers in the MLP when `widths` is not explicitly provided. Must be
51-
used together with `width`. Default is 2.
52-
width : int, optional
53-
Number of units per layer when `widths` is not explicitly provided. Must be used
54-
together with `depth`. Default is 256.
5547
widths : Sequence[int], optional
56-
Explicitly defines the number of hidden units per layer. If provided, `depth` and
57-
`width` should not be specified. Default is None.
48+
Defines the number of hidden units per layer, as well as the number of layers to be used.
5849
activation : str, optional
5950
Activation function applied in the hidden layers, such as "mish". Default is "mish".
6051
kernel_initializer : str, optional
@@ -76,17 +67,6 @@ def __init__(
7667

7768
super().__init__(**keras_kwargs(kwargs))
7869

79-
if widths is not None:
80-
if depth is not None or width is not None:
81-
raise ValueError("Either specify 'widths' or 'depth' and 'width', not both.")
82-
else:
83-
if depth is None or width is None:
84-
# use the default
85-
depth = 2
86-
width = 256
87-
88-
widths = [width] * depth
89-
9070
self.res_blocks = []
9171
for width in widths:
9272
self.res_blocks.append(

0 commit comments

Comments
 (0)