node_functions module
Full Documentation for hippynn.graphs.nodes.base.node_functions
module.
Click here for a summary page.
Base node definition.
- exception NodeAmbiguityError[source]
Bases:
NodeOperationError
- exception NodeNotFound[source]
Bases:
NodeOperationError
- find_relatives(node_or_nodes, constraint_key, why_desc='<purpose not specified>')[source]
- Parameters:
node_or_nodes – a node or iterable of nodes to start the search.
constraint_key –
callable to filter nodes by or
type spec to be used with isinstance.
why_desc – If a node cannot be found satisfying the constraint, raise an error with this message.
- Returns:
set of nodes related to this node that obey a constraint
- find_unique_relative(node_or_nodes, constraint, why_desc='<purpose not specified>')[source]
Look for a unique parent or child node type in the graph connected to the starting node.
- Parameters:
node_or_nodes – a node or iterable of nodes to start the search.
constraint –
callable to filter nodes by or
type to be used with isinstance.
why_desc – specification of error message
- Returns:
Node compatible with constraint.
Note
If no node is found, a NodeNotFoundError is rasied. If more than one node is found, a NodeambiguityError is raised.