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 can mutate the original network #211

Closed
arvoelke opened this issue Mar 29, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@arvoelke
Copy link
Contributor

commented Mar 29, 2019

self.host = Network(seed=original.seed)
self.chip = Network(seed=original.seed)
self.host_pre = Network(seed=original.seed)

^ Should pass add_to_container=False, otherwise weird things can happen like in the following code:

with nengo.Network() as model:
    
    x = nengo.Ensemble(100, 1)
    
    with nengo_loihi.Simulator(model) as sim:
        pass

    print(model.all_networks)

(prints 3 networks)

Each split adds all of the splitter sub-networks to the original model. Note this only happens if the simulator is constructed from within the context manager of some network.

@arvoelke arvoelke added the bug label Mar 29, 2019

@arvoelke arvoelke self-assigned this Mar 29, 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

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.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to 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.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to 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.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to zero.

tbekolay added a commit that referenced this issue Apr 23, 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.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to zero.

arvoelke added a commit that referenced this issue Apr 23, 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.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to zero.

tbekolay added a commit that referenced this issue Apr 24, 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 `Split` class takes on the
organizational tasks of the old `Splitter`, giving directives to
the builder about what should be on- or off-chip.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to zero.

The passthrough removal process was also modified to act in the
same way as `Split`, and is now named `PassthroughSplit` accordingly.

Co-authored-by: Trevor Bekolay <tbekolay@gmail.com>

tbekolay added a commit that referenced this issue Apr 24, 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 `Split` class takes on the
organizational tasks of the old `Splitter`, giving directives to
the builder about what should be on- or off-chip.

Several tests were added or modified to ensure that these changes
did not affect built models in adverse ways. Some tests were added
to ensure that the refactoring made improvements; for example, the
refactored splitter no longer mutates networks, which closes #211.
Simulations should now be identical whether precompute is True
or False, so the tolerance in test_precompute is now set to zero.

The passthrough removal process was also modified to act in the
same way as `Split`, and is now named `PassthroughSplit` accordingly.

Co-authored-by: Trevor Bekolay <tbekolay@gmail.com>

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