opto.trace.nodes.node#
- node(data, name=None, trainable=False, description=None, constraint=None)[source]#
Create a Node object from data.
- Parameters:
data โ The data to create the Node from.
name (str, optional) โ The name of the Node.
trainable (bool, optional) โ Whether the Node is trainable. Defaults to False.
description (str, optional) โ A string describing the data.
constraint (str, optional) โ A string describing any constraint that the data should obey.
- Returns:
A Node object containing the data.
- Return type:
Notes
- If trainable=True:
If data is already a Node, extracts underlying data and updates name
Creates ParameterNode with extracted data, name, trainable=True and constraint
- If trainable=False:
If data is already a Node, returns it (with warning if name provided)
Otherwise creates new Node with data, name and constraint