nengo / nengo-loihi

Run Nengo models on Intel's Loihi chip
https://www.nengo.ai/nengo-loihi/
Other
35 stars 12 forks source link

Splitter can mutate the original network #211

Closed arvoelke closed 5 years ago

arvoelke commented 5 years ago

https://github.com/nengo/nengo-loihi/blob/1517915baa1b0200e5241ba55a65e9d0bc09bff8/nengo_loihi/splitter.py#L61-L64

^ 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.