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 parameters.

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=None, feedback=None, label=None, seed=None, add_to_container=None)[source]

An ensemble to be run on the FPGA


The name of the fpga defined in the config file.


The number of neurons.


The number of representational dimensions.


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

functioncallable 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_argsdictionary, optional (Default: Empty dictionary)

Parameters to pass on to the socket object that is used to handle UDP communication between the host PC and the FPGA board. Acceptable parameters are: connect_timeout: Determines the maximum timeout to wait for a connection from the FPGA board. Default: 300s recv_timeout: Determines the maximum timeout for each packet received from the FPGA board. Default: 0.1s

feedbackfloat 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.

labelstr, optional (Default: None)

A descriptive label for the connection.

seedint, optional (Default: None)

The seed used for random number generation.

add_to_containerbool, 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.


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


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


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


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


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


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

get_output_dim(self, function, dimensions)[source]

Simplify init function by moving output shape calculation here

property local_data_filepath

Full path to ensemble parameter value data file on the local system.

Ensemble parameter values are generated by the builder.


Send termination packet to FPGA board.

Termination packet is a packet where t is less than 0.


Shutdown connections to FPGA if applicable


Remove FPGA data file if applicable

connect_ssh_client(self, ssh_user, remote_ip)[source]

Helper function to parse config and setup ssh client


Start SSH in a separate thread if applicable


Connect to FPGA via SSH if applicable

process_ssh_output(self, data)[source]

Clean up the data stream coming back over ssh if applicable

check_ssh_str(self, info_str, error_strs, got_error, remote_ip)[source]

Process info from ssh and check for errors


Reconnect to FPGA if applicable

property ssh_string

Command sent to FPGA device to begin execution

Generate the string to be sent over the ssh connection to run the remote side ssh script (with appropriate arguments)