Register Bricks
- class fugu.bricks.register_bricks.Register(max_size, initial_value=0, name='Register', output_coding='Undefined', register_label=None, single_set=False)
Bases:
BrickBrick that stores the binary encoding of an non-negative integer. This brick also provides simple controls such as “recall”, “clear”, and “set”
- build(graph, metadata, control_nodes, input_lists, input_codings)
Build Register brick.
- Parameters:
graph – networkx graph to define connections of the computational graph
metadata (dict) – dictionary to define the shapes and parameters of the brick
control_nodes (dict) –
dictionary of lists of auxillary networkx nodes. Expected keys:
’complete’ - A list of neurons that fire when the brick is done
input_lists (list) – list of nodes that will contain input
input_coding (list) – list of input coding formats. All coding types supported
- Returns:
graph of a computational elements and connections begin: dictionary of output parameters (shape, coding, layers, depth, etc) complete: dictionary of control nodes (‘complete’) output_lists (list): list of output self.output_codings (list): list of coding formats of output
- Return type:
graph
- class fugu.bricks.register_bricks.Max(default_size=-1, name='Max', output_coding='Undefined')
Bases:
BrickBrick that calculates the maximum value of a collection of values stored as binary registers.
- build(graph, metadata, control_nodes, input_lists, input_codings)
Build Register brick.
- Parameters:
graph – networkx graph to define connections of the computational graph
metadata (dict) – dictionary to define the shapes and parameters of the brick
control_nodes (dict) –
dictionary of lists of auxillary networkx nodes. Expected keys:
’complete’ - A list of neurons that fire when the brick is done
input_lists (list) – list of nodes that will contain input
input_coding (list) – list of input coding formats. All coding types supported
- Returns:
graph of a computational elements and connections begin: dictionary of output parameters (shape, coding, layers, depth, etc) complete: dictionary of control nodes (‘complete’) output_lists: list of output self.output_codings: list of coding formats of output
- Return type:
graph
- class fugu.bricks.register_bricks.Addition(register_size=5, name='Addition', output_coding='Undefined')
Bases:
BrickBrick that calculates the sum of two values stored as binary
- build(graph, metadata, control_nodes, input_lists, input_codings)
Build Addition brick. :param graph: networkx graph to define connections of the computational graph :param metadata: dictionary to define the shapes and parameters of the brick :type metadata: dict :param control_nodes: dictionary of lists of auxillary networkx nodes.
- Expected keys:
‘complete’ - A list of neurons that fire when the brick is done
- Parameters:
input_lists (list) – list of nodes that will contain input
input_coding (list) – list of input coding formats. All coding types supported
- Returns:
graph of a computational elements and connections begin (dict): dictionary of output parameters (shape, coding, layers, depth, etc) complete (dict): dictionary of control nodes (‘complete’) output_lists (list): list of output self.output_codings (list): list of coding formats of output
- Return type:
graph
- Raises:
ValueError – Too many inputs! {} can only support two inputs, received: {}
- class fugu.bricks.register_bricks.Subtraction(register_size=5, name='Subtraction', output_coding='Undefined')
Bases:
CompoundBrickBrick that calculates the difference of two values stored as binary values. The brick subtracts the second (Y) input from the first (X), i.e. this brick returns the value of X - Y
- build(graph, metadata, control_nodes, input_lists, input_codings)
Build Subtraction brick. :param graph: networkx graph to define connections of the computational graph :param metadata: dictionary to define the shapes and parameters of the brick :param control_nodes: dictionary of lists of auxillary networkx nodes.
- Expected keys:
‘complete’ - A list of neurons that fire when the brick is done
- Parameters:
input_lists – list of nodes that will contain input
input_coding – list of input coding formats. All coding types supported
- Returns:
graph of a computational elements and connections complete: dictionary of control nodes (‘complete’) begin: dictionary of output parameters (shape, coding, layers, depth, etc) output_lists (list): list of output self.output_codings (list): list of coding formats of output
- Return type:
graph