@@ -20,10 +20,8 @@ class MLP(keras.Layer):
2020
2121 def __init__ (
2222 self ,
23+ widths : Sequence [int ] = (256 , 256 ),
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