Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nengo.Node and learning rule don't work with the partitioner/assignments? #24

Open
adityagilra opened this issue Aug 24, 2016 · 0 comments

Comments

@adityagilra
Copy link

adityagilra commented Aug 24, 2016

1

To get current nengo_mpi working with current nengo git repo '2.2.0.dev0', I had to do the following:

I need to comment in file "/root/nengo_git/nengo/cache.py", line 331:
#warnings.warn("Cannot shrink outside of a with cache block.")
Else a warning stops the run.

2

A minor issue:
I need to put in a line in simulator.py line 185: if len(data)>0:
(This is needed if I have a probe with a sample_every which is higher than dt, and is thus empty if a small run is given -- I give multiple run-s in a loop so over time it will not be empty.)

3

I am unable to get Node to work with the partitioner, it works (at least the script runs) without the partitioner.
Test script below:

import nengo_mpi
import nengo

model = nengo.Network()
with model:
    A = nengo.Node( size_in=2, size_out=2, output = lambda timeval,currval: (0.,0.) )
    #A = nengo.Ensemble(n_neurons=50, dimensions=2)
    B = nengo.Ensemble(n_neurons=50, dimensions=2)
    nengo.Connection(A, B)

#assignments = {A: 0, B: 1}
#sim = nengo_mpi.Simulator(model, assignments=assignments)
partitioner = nengo_mpi.Partitioner(n_components=8)
sim = nengo_mpi.Simulator(model, 1e-3, partitioner=partitioner)
sim.run(1.0)
sim.run(1.0)

4

With a learning rule on a connection (neurons to neurons), the partitioner gives this error:
(no error without the learning rule attached)
File "/root/nengo_mpi/nengo_mpi/partition/base.py", line 397, in merge_clusters
self._map[conn.learning_rule] = a
TypeError: unhashable type: 'dict'

and the assignments give this error:
nengo_mpi.PartitionError: Connection <Connection from <Neurons of <Ensemble (unlabeled) at 0x7ff20fad6350>> to <Neurons of <Ensemble (unlabeled) at 0x7ff228151450>>> crosses a component boundary, but it is not permitted to. Pre-object assigned to 0, post-object assigned to 1.

Script as below:

import nengo_mpi
import nengo

model = nengo.Network()
with model:
    #A = nengo.Node( size_in=2, size_out=2, output = lambda timeval,currval: (0.,0.) )
    A = nengo.Ensemble(n_neurons=50, dimensions=2)
    B = nengo.Ensemble(n_neurons=50, dimensions=2)
    AtoB = nengo.Connection(A.neurons, B.neurons)
    lruleDict = { 'PES' : nengo.PES(learning_rate=1e-3,pre_tau=1e-2) }
    AtoB.learning_rule_type = lruleDict

assignments = {A: 0, B: 1}
sim = nengo_mpi.Simulator(model, assignments=assignments)
#partitioner = nengo_mpi.Partitioner(n_components=8)
#sim = nengo_mpi.Simulator(model, 1e-3, partitioner=partitioner)
sim.run(1.0)
sim.run(1.0)

Thanks.

@adityagilra adityagilra changed the title nengo.Node doesn't work with the partitioner? nengo.Node and learning rule don't work with the partitioner/assignments? Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant