lambda_node#

maize.utilities.macros.lambda_node(func: Callable[[Any], Any]) type[Node][source]#

Convert an anonymous function with single I/O into a node.

Parameters:

func – Lambda function taking a single argument and producing a single output

Returns:

Custom lambda wrapper node

Return type:

type[Node]

Examples

>>> lam = flow.add(lambda_node(lambda x: 2 * x))
>>> flow.connect_all((first.out, lam.inp), (lam.out, last.inp))