Skip to content

Commit 114b6cc

Browse files
LarsKueCopilot
andauthored
Add docstring to custom Sequential
Co-authored-by: Copilot <[email protected]>
1 parent d086c05 commit 114b6cc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

bayesflow/networks/sequential/sequential.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@
77

88
@serializable("bayesflow.networks")
99
class Sequential(keras.Layer):
10+
"""
11+
A custom sequential model for managing a sequence of Keras layers.
12+
13+
This class extends `keras.Layer` and provides functionality for building,
14+
calling, and serializing a sequence of layers. Unlike `keras.Sequential`,
15+
this implementation allows for more flexibility in handling layer arguments
16+
and supports custom serialization through the `@serializable` decorator.
17+
18+
Parameters
19+
----------
20+
layers : keras.Layer or Sequence[keras.Layer]
21+
A single Keras layer or a sequence of Keras layers to be managed by this model.
22+
**kwargs : dict
23+
Additional keyword arguments passed to the base `keras.Layer` class.
24+
25+
Notes
26+
-----
27+
- This class differs from `keras.Sequential` in that it does not assume a strict
28+
linear stack of layers and provides custom methods for serialization and
29+
configuration.
30+
- It is designed to integrate with the BayesFlow framework and supports
31+
additional utilities like `layer_kwargs`.
32+
"""
1033
def __init__(self, *layers: keras.Layer | Sequence[keras.Layer], **kwargs):
1134
super().__init__(**layer_kwargs(kwargs))
1235
if len(layers) == 1 and isinstance(layers[0], Sequence):

0 commit comments

Comments
 (0)