Test Bricks

These bricks are used to test features/capabilities of fugu backends.

class fugu.bricks.test_bricks.Delay(delay_value, name='Delay')

Bases: Brick

A brick that implements a simple chain of neurons.

Construtor for this brick. :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str

build(graph, metadata, control_nodes, input_lists, input_codings)

Build neuron chain brick.

Parameters:
  • graph ({add_node, add_edge}) – networkx graph to define connections of the computational graph

  • metadata (dict) – dictionary to define the shapes and parameters of the brick

  • control_nodes (list) –

    list of dictionary of auxillary 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. (‘Raster’, ‘Undefined’ supported)

Returns:

graph of a computational elements and connections metadata (dict): dictionary of output parameters (shape, coding, layers, depth, etc) complete_name (str): list dictionary of control nodes (‘complete’) main_name: list of output edges input_codings (list): list of coding formats of output (‘current’)

Return type:

graph (any)

class fugu.bricks.test_bricks.NeuronChain(num_neurons, name='NeuronChain')

Bases: Brick

A brick that implements a simple chain of neurons.

Construtor for this brick. :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str

build(graph, metadata, control_nodes, input_lists, input_codings)

Build neuron chain brick.

Parameters:
  • graph ({add_node, add_edge}) – networkx graph to define connections of the computational graph

  • metadata (dict) – dictionary to define the shapes and parameters of the brick

  • control_nodes (list) –

    list of dictionary of auxillary 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. (‘Raster’, ‘Undefined’ supported)

Returns:

graph of a computational elements and connections metadata (dict): dictionary of output parameters (shape, coding, layers, depth, etc) complete_name (str): list dictionary of control nodes (‘complete’) main_name: list of output edges input_codings (list): list of coding formats of output (‘current’)

Return type:

graph (any)

class fugu.bricks.test_bricks.InstantDecay(num_inputs, name='InstantDecay')

Bases: Brick

A brick used to test neurons that have instant decay.

Construtor for this brick. :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Dot brick.

Parameters:
  • graph ({add_node, add_edge}) – networkx graph to define connections of the computational graph

  • metadata (dict) – dictionary to define the shapes and parameters of the brick

  • control_nodes (list) –

    list of dictionary of auxillary 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. (‘Raster’, ‘Undefined’ supported)

Returns:

graph of a computational elements and connections metadata (dict): dictionary of output parameters (shape, coding, layers, depth, etc) complete_name (str): list dictionary of control nodes (‘complete’) main_name: list of output edges input_codings (list): list of coding formats of output (‘current’)

Return type:

graph (any)

class fugu.bricks.test_bricks.SynapseProperties(weights, name='SynapseProperties')

Bases: Brick

A brick used to test neurons that have instant decay.

Construtor for this brick. :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str

set_properties(properties)

Returns an updated version of the graph based on the property values passed.

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Dot 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: list of dictionary of auxillary 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. (‘Raster’, ‘Undefined’ supported)

Returns:

graph of a computational elements and connections metadata (dict): dictionary of output parameters (shape, coding, layers, depth, etc) complete_name (str): list dictionary of control nodes (‘complete’) output_list (list[str]): list of output edges input_coding (list): list of coding formats of output (‘current’)

Return type:

graph

class fugu.bricks.test_bricks.SumOfMaxes(set_sizes=[5, 5], name='SumOfMaxes')

Bases: CompoundBrick

A brick that computes the max of N sets of values and reports the sum of those maxes.

Construtor for this brick. :param set_sizes: Number of inputs for each max brick :type set_sizes: list[int] :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str

build(graph, metadata, control_nodes, input_lists, input_codings)

Build SumOfMaxes 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 (list) –

    list of dictionary of auxillary 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. (‘Raster’, ‘Undefined’ supported)

Returns:

graph of a computational elements and connections metadata (str): dictionary of output parameters (shape, coding, layers, depth, etc) complete_name (str): list dictionary of control nodes (‘complete’) child_output (any): list of output edges input_codings (list): list of coding formats of output (‘current’)

Return type:

graph

Raises:

ValueError – unexpected amount of input