reservoirpy.ops.merge#
- class reservoirpy.ops.merge(model, *models, inplace=False, name=None)[source]#
Merge different
Model
orNode
instances into a singleModel
instance.Node
instances contained in the models to merge will be gathered in a single model, along with all previously defined connections between them, if they exists.You can also perform this operation using the
&
operator:model = (node1 >> node2) & (node1 >> node3))
This is equivalent to:
model = merge((node1 >> node2), (node1 >> node3))
The in-place operator can also be used:
model &= other_model
Which is equivalent to:
model.update_graph(other_model.nodes, other_model.edges)
- Parameters:
model (Model or Node) – First node or model to merge. The inplace parameter takes this instance as reference.
inplace (bool, default to False) – If True, then will update Model model in-place. If model is not a Model instance, this parameter will causes the function to raise a ValueError.
name (str, optional) – Name of the resulting Model.
- Returns:
A new
Model
instance.- Return type:
- Raises:
ValueError – If inplace is True but model is not a Model instance, then the operation is impossible. In-place merging can only take place on a Model instance.