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

Splitter fails for sliced connections and probes #205

Closed
arvoelke opened this issue Mar 27, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@arvoelke
Copy link
Contributor

commented Mar 27, 2019

The following code has different behaviour for connections from a[0] versus a even though they are the same object (a is one-dimensional).

import nengo
import nengo_loihi

def go(do_bug):
    with nengo.Network() as model:
        nengo_loihi.add_params(model)

        a = nengo.Ensemble(1, 1, label="a")
        b = nengo.Ensemble(1, 1, label="b")
        model.config[b].on_chip = False

        nengo.Connection(a[0] if do_bug else a, b)

    with nengo_loihi.Simulator(model) as sim:
        pass

go(False)
go(True)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-148-00268f888de2> in <module>()
     16 
     17 go(False)
---> 18 go(True)

<ipython-input-148-00268f888de2> in go(do_bug)
     12         nengo.Connection(a[0] if do_bug else a, b)
     13 
---> 14     with nengo_loihi.Simulator(model) as sim:
     15         pass
     16 

~/CTN/nengo-loihi/nengo_loihi/simulator.py in __init__(self, network, dt, seed, model, precompute, target, progress_bar, remove_passthrough)
    364             # We could warn about this, but we want to avoid people having
    365             # to specify `precompute` unless they absolutely have to.
--> 366             self.precompute = True
    367 
    368         # Build the network into the model

~/CTN/nengo-loihi/nengo_loihi/builder/builder.py in build(self, obj, *args, **kwargs)
    152 
    153     def build(self, obj, *args, **kwargs):
--> 154         built = self.builder.build(self, obj, *args, **kwargs)
    155         if self.build_callback is not None:
    156             self.build_callback(obj)

~/CTN/nengo/nengo/builder/builder.py in build(cls, model, obj, *args, **kwargs)
    216                 "Cannot build object of type %r" % type(obj).__name__)
    217 
--> 218         return cls.builders[obj_cls](model, obj, *args, **kwargs)
    219 
    220     @classmethod

~/CTN/nengo/nengo/builder/network.py in build_network(model, network, progress)
     96         logger.debug("Network step 4: Building probes")
     97         for probe in network.probes:
---> 98             model.build(probe)
     99 
    100         if context is model.decoder_cache:

~/CTN/nengo-loihi/nengo_loihi/builder/builder.py in build(self, obj, *args, **kwargs)
    152 
    153     def build(self, obj, *args, **kwargs):
--> 154         built = self.builder.build(self, obj, *args, **kwargs)
    155         if self.build_callback is not None:
    156             self.build_callback(obj)

~/CTN/nengo/nengo/builder/builder.py in build(cls, model, obj, *args, **kwargs)
    216                 "Cannot build object of type %r" % type(obj).__name__)
    217 
--> 218         return cls.builders[obj_cls](model, obj, *args, **kwargs)
    219 
    220     @classmethod

~/CTN/nengo-loihi/nengo_loihi/builder/probe.py in build_probe(model, probe)
    148     key = probeables[probe.attr] if probe.attr in probeables else probe.attr
    149     if key is None:
--> 150         conn_probe(model, probe)
    151     else:
    152         signal_probe(model, key, probe)

~/CTN/nengo-loihi/nengo_loihi/builder/probe.py in conn_probe(model, nengo_probe)
     79     else:
     80         raise NotImplementedError(
---> 81             "Nodes cannot be onchip, connections not yet probeable")
     82 
     83     probe = Probe(key='voltage', weights=weights, synapse=nengo_probe.synapse)

NotImplementedError: Nodes cannot be onchip, connections not yet probeable

@arvoelke arvoelke added the bug label Mar 27, 2019

@arvoelke arvoelke self-assigned this Mar 27, 2019

@arvoelke arvoelke changed the title Splitter tries to put node on chip for sliced connection Splitter fails for sliced connections and probes Mar 27, 2019

@arvoelke

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

Here's a simpler test that fails with the same error message:

with nengo.Network() as model:
    a = nengo.Ensemble(1, 1, label="a")
    p = nengo.Probe(a[0])

with nengo_loihi.Simulator(model) as sim:
    pass

arvoelke added a commit that referenced this issue Apr 1, 2019

hunse added a commit that referenced this issue Apr 3, 2019

Combine splitter into builder
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip. Fixes #208
  and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Various improvements to passthrough removal, including not removing
  useful passthrough nodes.
  Outstanding issues include: #210, #212, #213
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.

hunse added a commit that referenced this issue Apr 3, 2019

Combine splitter into builder
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip. Fixes #208
  and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Various improvements to passthrough removal, including not removing
  useful passthrough nodes.
  Outstanding issues include: #210, #212, #213
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.

hunse added a commit that referenced this issue Apr 9, 2019

Combine splitter into builder
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip or learning and
  `precompute` are combined. Fixes #208 and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.
- Simulation is now identical whether precompute is True or False,
  on both emulator and chip. The tolerance for test_precompute is
  now zero.

tbekolay added a commit that referenced this issue Apr 15, 2019

Combine splitter into builder
Most of the work done by the splitter is now done in the builder.
This should give more clarity and control over the mapping between
pre-build and post-build objects. The `SplitterDirective` class
takes on the organizational tasks of the old `Splitter`, giving
directives to the builder about what should be on- or off-chip.

Also:
- Add unit tests for splitter refactoring.
- Raise `BuildError` if learning objects are on_chip or learning and
  `precompute` are combined. Fixes #208 and #209.
- Pass no decoder cache to sub-models. Decoder cache wasn't working
  due to lack of context manager which is normally constructed by
  the top-level network build. Fixes #207.
- Handle sliced probes. Closes #205.
- Check that splitter handles sliced probes. Closes #206.
- Test that splitter does not mutate network. Closes #211.
- Simulation is now identical whether precompute is True or False,
  on both emulator and chip. The tolerance for test_precompute is
  now zero.

tbekolay added a commit that referenced this issue Apr 15, 2019

tbekolay added a commit that referenced this issue Apr 15, 2019

tbekolay added a commit that referenced this issue Apr 15, 2019

tbekolay added a commit that referenced this issue Apr 23, 2019

tbekolay added a commit that referenced this issue Apr 23, 2019

arvoelke added a commit that referenced this issue Apr 23, 2019

tbekolay added a commit that referenced this issue Apr 24, 2019

tbekolay added a commit that referenced this issue Apr 24, 2019

@tbekolay tbekolay closed this in e116b91 Apr 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.