Skip to content

Non-f-of-t Nodes break when fed into passthrough Nones #165

@tcstewar

Description

@tcstewar

Here's a minimal example:

import nengo
import nengo_spinnaker
import numpy as np

model = nengo.Network()
with model:
    def stim_func(t):
        return np.sin(t), np.cos(t)
    stim = nengo.Node(stim_func)

    ea = nengo.networks.EnsembleArray(n_neurons=50, n_ensembles=2)
    nengo.Connection(stim, ea.input)

sim = nengo_spinnaker.Simulator(model)
sim.run(1)

and here's the error:

Building finished in 0:00:01.
Traceback (most recent call last):
  File "input_func_test.py", line 15, in <module>
    sim.run(1)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/simulator.py", line 244, in run
    self.run_steps(steps)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/simulator.py", line 250, in run_steps
    self._run_steps(n_steps)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/simulator.py", line 300, in _run_steps
    self.host_sim.step()
  File "/localhome/tcstewar/github/nengo/nengo/simulator.py", line 308, in step
    step_fn()
  File "/localhome/tcstewar/github/nengo/nengo/builder/operator.py", line 626, in step_simpyfunc
    y = fn(t.item(), *args) if t is not None else fn(*args)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/simulator.py", line 377, in func
    return f(t, x)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/builder/node.py", line 340, in output
    self.controller.set_node_output(self.target, value)
  File "/localhome/tcstewar/github/nengo_spinnaker/nengo_spinnaker/node_io/ethernet.py", line 126, in set_node_output
    c_value = np.dot(transform, c_value)
ValueError: shapes (1,1) and (2,) not aligned: 1 (dim 1) != 2 (dim 0)

This doesn't happen if the input goes straight to an Ensemble, or if the input is marked as function_of_time=True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions