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

Passthrough removal fails for sliced probes #206

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

Comments

Projects
None yet
2 participants
@arvoelke
Copy link
Contributor

commented Mar 27, 2019

def go(do_bug):
    with nengo.Network() as model:
        a = nengo.Ensemble(1, 1, label="a")
        passthrough = nengo.Node(size_in=1, label="passthrough")
        b = nengo.Ensemble(1, 1, label="b")

        nengo.Connection(a, passthrough)
        nengo.Connection(passthrough, b)

        p = nengo.Probe(passthrough[0] if do_bug else passthrough)

    with nengo_loihi.Simulator(model, remove_passthrough=True) as sim:
        pass

go(False)
go(True)
AssertionError                            Traceback (most recent call last)
<ipython-input-1-bbe32de37e3c> in <module>()
     21 
     22 go(False)
---> 23 go(True)

<ipython-input-1-bbe32de37e3c> in go(do_bug)
     17         p = nengo.Probe(passthrough[0] if do_bug else passthrough)
     18 
---> 19     with nengo_loihi.Simulator(model, remove_passthrough=True) as sim:
     20         pass
     21 

~/CTN/nengo-loihi/nengo_loihi/simulator.py in __init__(self, network, dt, seed, model, precompute, target, progress_bar, remove_passthrough)
    328             node_neurons=self.model.node_neurons,
    329             node_tau=self.model.decode_tau,
--> 330             remove_passthrough=remove_passthrough,
    331         )
    332         network = self.networks.chip

~/CTN/nengo-loihi/nengo_loihi/splitter.py in split(net, precompute, node_neurons, node_tau, remove_passthrough)
    144 
    145     # --- Step 5: place probes
--> 146     place_probes(networks)
    147 
    148     # Commit to the moves marked in the previous steps

~/CTN/nengo-loihi/nengo_loihi/splitter.py in place_probes(networks)
    484     for probe in networks.original.all_probes:
    485         target = base_obj(probe.target)
--> 486         networks.move(probe, networks.location(target))
    487 
    488 

~/CTN/nengo-loihi/nengo_loihi/splitter.py in move(self, obj, target, force)
     99         if not force:
    100             assert obj not in self, "already moved"
--> 101         assert target in self.targets, "invalid target"
    102         logger.debug("Moving %s to %s", obj, target)
    103         if obj in self.adds:

AssertionError: invalid target

The bug does not happen when remove_passthrough=False.

I believe the fix is to change this line:

probed_objs = set(base_obj(p.target) for p in net.all_probes)

so that ObjView are resolved into their underlying base objects (as done in the splitter). Note the other base_obj calls are okay, because they all use pre_obj and post_obj which already resolve the ObjView.

Note this issue is somewhat independent of #205, as the latter bug occurs even when remove_passthrough=False.

@arvoelke arvoelke added the bug label Mar 27, 2019

@arvoelke arvoelke self-assigned this Mar 27, 2019

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 added a commit that referenced this issue Apr 24, 2019

@tbekolay

This comment has been minimized.

Copy link
Member

commented Apr 26, 2019

Done in #202.

@tbekolay tbekolay closed this 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.