How to use the nengo.networks.EnsembleArray function in nengo

To help you get started, we’ve selected a few nengo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hunse / nef-rbm / sigmoid-rbm / run_dbn.py View on Github external
find_neuron_params.find_params(savefile=neuron_params_file, show=False)

neuron_params = dict(np.load(neuron_params_file))
N = neuron_params.pop('N')
# neuron_params['radius'] = np.array([1,2])

# --- create the model
model = nengo.Network()
with model:
    input_images = nengo.Node(output=get_image, label='images')

    # --- make sigmoidal layers
    layers = []
    output = input_images
    for w, b in zip(weights[:-1], biases[:-1]):
        layer = nengo.networks.EnsembleArray(N, b.size, **neuron_params)
        bias = nengo.Node(output=b)
        nengo.Connection(bias, layer.input, synapse=0)

        nengo.Connection(output, layer.input, transform=w.T, synapse=pstc)
        output = layer.add_output('sigmoid', function=sigmoid)

        layers.append(layer)

    # --- make code layer
    W, b = weights[-1], biases[-1]
    code_layer = nengo.networks.EnsembleArray(10, b.size, label='code', radius=10)
    code_bias = nengo.Node(output=b)
    nengo.Connection(code_bias, code_layer.input, synapse=0)
    nengo.Connection(output, code_layer.input, transform=W.T, synapse=pstc)

    # --- make classifier layer