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

Adding neuron input to EnsembleArray raises error #89

Open
pabogdan opened this issue Nov 20, 2015 · 12 comments
Open

Adding neuron input to EnsembleArray raises error #89

pabogdan opened this issue Nov 20, 2015 · 12 comments

Comments

@pabogdan
Copy link

Minimal example:

import nengo
import numpy as np

model = nengo.Network("Broken!")

with model:
    some_input = nengo.Node(np.sin)
    some_inhibition = nengo.Node(np.cos)

    A = nengo.networks.EnsembleArray(n_neurons=100, n_ensembles=1, ens_dimensions=1)
    inhibiting_input = A.add_neuron_input()

    nengo.Connection(some_input, A.input)
    nengo.Connection(some_inhibition, inhibiting_input, transform=[[-2.5]]*100)

This works with nengo, fails with nengo_spinnaker.

Traceback (most recent call last):
  File "/home/bogdanp/nengo_gui/nengo_gui/page.py", line 435, in build
    self.sim = backend.Simulator(self.model)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/simulator.py", line 103, in __init__
    self.model.build(network, **builder_kwargs)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/builder.py", line 204, in build
    self._build_network(network)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/builder.py", line 212, in _build_network
    self._build_network(subnet)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/builder.py", line 224, in _build_network
    self.make_connection(connection)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/builder.py", line 257, in make_connection
    sink = self._sink_getters[post_type](self, conn)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/ensemble.py", line 64, in get_neurons_sink
    elif np.all(connection.transform[1:] == connection.transform[0]):
ValueError: cannot slice a 0-d array
@mundya
Copy link
Member

mundya commented Nov 27, 2015

(Just a note, this is kind of an instance of #30)

@mundya
Copy link
Member

mundya commented Nov 27, 2015

Fixing this is on the todo list for Spaun, a quick work around whenever you want to do this kind of thing is:

for ens in A.ea_ensembles:
    nengo.Connection(x, ens.neurons, transform=[[-2.5]] * ens.n_neurons)

@pabogdan
Copy link
Author

This is the effect of the suggested hack. Should I revert back to multiple Ensembles instead of using EnsembleArrays?

Traceback (most recent call last):
  File "/home/bogdanp/nengo_gui/nengo_gui/page.py", line 464, in runner
    self.sim.run_steps(self.sim.max_steps)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/simulator.py", line 195, in run_steps
    self._run_steps(n_steps)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/simulator.py", line 246, in _run_steps
    self.host_sim.step()
  File "/usr/local/lib/python2.7/dist-packages/nengo-2.1.0_dev-py2.7.egg/nengo/simulator.py", line 181, in step
    step_fn()
  File "/usr/local/lib/python2.7/dist-packages/nengo-2.1.0_dev-py2.7.egg/nengo/builder/operator.py", line 384, in step_simpyfunc
    y = fn(t_sig.item(), *args) if t_in else fn(*args)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/simulator.py", line 305, in func
    return f(t, x)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/builder/node.py", line 380, in output
    self.controller.set_node_output(self.target, value)
  File "/home/bogdanp/nengo_spinnaker/nengo_spinnaker/node_io/ethernet.py", line 128, in set_node_output
    self.out_socket.sendto(packet.bytestring,
  File "/usr/local/lib/python2.7/dist-packages/rig-0.8.0-py2.7.egg/rig/machine_control/packets.py", line 65, in bytestring
    (self.src_port & 0x7) << 5 | (self.src_cpu & 0x1f),
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

@mundya
Copy link
Member

mundya commented Nov 30, 2015

Sorry, can you update your copy of Rig?

@pabogdan
Copy link
Author

I don't know what x is, but I can running the debugger and check. Will also update rig and see how it goes.

Update 1: pip causing issues and trying to install numpy. Will try and install rig manually, from git

@mundya
Copy link
Member

mundya commented Nov 30, 2015

(Re x, I meant the object you were connecting to the neurons from [in the example from 3 days ago])

@pabogdan
Copy link
Author

Manually installing rig from git seems to work (could you please update the pip packages so that everything works with python setup.py by default?).

I am connecting the output of a Basal Ganglia directly to the neurons, so the transform is [[1]] * n_neurons

@mundya thank you!

@mundya
Copy link
Member

mundya commented Nov 30, 2015

could you please update the pip packages so that everything works with python setup.py by default?

As far as I can tell the version of Rig on PIP is correct (0.10.0), did pip install -U rig not work for you?

@mossblaser
Copy link
Member

Manually installing rig from git seems to work (could you please update
the pip packages so that everything works withpython setup.py by
default?).

The offending change is already released, I believe. Try

pip install "rig>=0.10.0"

On 30 November 2015 at 09:56, Petrut Antoniu Bogdan <
notifications@github.com> wrote:

Manually installing rig from git seems to work (could you please update
the pip packages so that everything works with python setup.py by
default?).

I am connecting the output of a Basal Ganglia directly to the neurons, so
the transform is [[1]] * n_neurons


Reply to this email directly or view it on GitHub
#89 (comment)
.

@mundya
Copy link
Member

mundya commented Jun 22, 2016

@pabogdan - when you're back from your well-earned break would you mind seeing if this is still a problem for you? Thanks :)

@pabogdan
Copy link
Author

@mundya I will definitely :) This will be around the 5th of July.

@mundya
Copy link
Member

mundya commented Jun 22, 2016

Thanks, 'fraid I won't be around until 19th.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants