Setting Parameters

Many of the Nengo ensemble parameters are omitted from the FpgaPesEnsembleNetwork constructor, but all of these ensemble parameters can easily be changed once an ensemble is created:

# First create the ensemble
ens = FpgaPesEnsembleNetwork(
         'de1', n_neurons=100, dimensions=2, learning_rate=1e-3)

# Modify ensemble parameters
ens.ensemble.neuron_type = nengo.neurons.RectifiedLinear()
ens.ensemble.intercepts = nengo.dists.Choice([-0.5])
ens.ensemble.max_rates = nengo.dists.Choice([100])

Since our FpgaPesEnsembleNetwork class also encompasses the connection from the FPGA ensemble, we can similarly change the connection parameters:

# Modify connection parameters
ens.connection.synapse = None
ens.connection.solver = nengo.solvers.LstsqL2(reg=0.01)

The 02-mnist_vision_network example demonstrates this capability.

If a recurrent connection exists, we can similarly modify that connection:

# Modify connection parameters
ens.feedback.synapse = 0.05
ens.feedback.function = lambda x: x*0.5

See also

Check out the Nengo documentation for a full list of ensemble parameters and connection parameter.

Supported Neuron Types

Currently NengoFPGA supports the following neuron types:

Objects and Functions

class nengo_fpga.networks.FpgaPesEnsembleNetwork(fpga_name, n_neurons, dimensions, learning_rate, function=Default, transform=Default, eval_points=Default, socket_args={}, feedback=None, label=None, seed=None, add_to_container=None)[source]

An ensemble to be run on the FPGA

fpga_name : str

The name of the fpga defined in the config file.

n_neurons : int

The number of neurons.

dimensions : int

The number of representational dimensions.

learning_rate : float

A scalar indicating the rate at which weights will be adjusted.

function : callable or (n_eval_points, size_mid) array_like, optional (Default: None)

Function to compute across the connection. Note that pre must be an ensemble to apply a function across the connection. If an array is passed, the function is implicitly defined by the points in the array and the provided eval_points, which have a one-to-one correspondence.

transform : (size_out, size_mid) array_like, optional (Default: np.array(1.0))

Linear transform mapping the pre output to the post input. This transform is in terms of the sliced size; if either pre or post is a slice, the transform must be shaped according to the sliced dimensionality. Additionally, the function is applied before the transform, so if a function is computed across the connection, the transform must be of shape (size_out, size_mid).

eval_points : (n_eval_points, size_in) array_like or int, optional (Default: None)

Points at which to evaluate function when computing decoders, spanning the interval (-pre.radius, pre.radius) in each dimension. If None, will use the eval_points associated with pre.

socket_args : dictionary, optional (Default: Empty dictionary)

Parameters to pass on to the sockets.UDPSendReceiveSocket object that is used to handle UDP communication between the host PC and the FPGA board. The full list of parameters can be found here: https://github.com/nengo/nengo-fpga/blob/master/nengo_fpga/sockets.py#L425

feedback : float or (D_out, D_in) array_like, optional

Defines the transform for a recurrent connection. If None, no recurrent connection will be built. The default synapse used for the recurrent connection is nengo.Lowpass(0.1), this can be changed using the feedback attribute of this class.

label : str, optional (Default: None)

A descriptive label for the connection.

seed : int, optional (Default: None)

The seed used for random number generation.

add_to_container : bool, optional (Default: None)

Determines if this network will be added to the current container. If None, this network will be added to the network at the top of the Network.context stack unless the stack is empty.

input : nengo.Node

A node that serves as the input interface between external Nengo objects and the FPGA board.

output : nengo.Node

A node that serves as the output interface between the FPGA board and external Nengo objects.

error : nengo.Node

A node that provides the error signal to be used by the learning rule on the FPGA board.

ensemble : nengo.Ensemble

An ensemble object whose parameters are used to configure the ensemble implementation on the FPGA board.

connection : nengo.Connection

The connection object used to configure the learning connection implementation on the FPGA board.

feedback : nengo.Connection

The connection object used to configure the recurrent connection implementation on the FPGA board.