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
Ensure things happen in consistent order #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Made some inline comments, and this needs a changelog.
It would also be nice if there was a test, but I have to admit I am struggling to think of a test that isn't trivial ... do you think this will end up getting tested in #70?
nengo_loihi/loihi_cx.py
Outdated
@@ -1164,12 +1166,12 @@ def receive(self, t, x): | |||
class ChipReceiveNode(nengo.Node): | |||
"""For receiving host->chip messages""" | |||
|
|||
def __init__(self, dimensions, size_out): | |||
def __init__(self, dimensions, size_out, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think **kwargs
is confusing here; for me, I don't really remember what other parameters there are to Node
. If I look it up and see size_in
, I'll get a TypeError
if I try to specify it. I think we should bite the bullet and expose label
and seed
(or just label
if seeds are irrelevant here).
nengo_loihi/loihi_cx.py
Outdated
@@ -1190,6 +1192,7 @@ def collect_spikes(self): | |||
|
|||
class ChipReceiveNeurons(ChipReceiveNode): | |||
"""Passes spikes directly (no on-off neuron encoding)""" | |||
def __init__(self, dimensions, neuron_type=None): | |||
def __init__(self, dimensions, neuron_type=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also, explicitly include label
and (perhaps) seed
.
From the review: we should add a test that splits a model multiple times and ensures that their order in the split networks is the same. |
I will write this test. |
c7e42b6
to
d83169c
Compare
Ok, I've added a test. I've tested that it can distinguish between before this PR and after it. |
- Splitter preserves object order from original network. - Host/chip receivers are always called in same order. Also added optional labels to ChipReceiveNodes and their CxSpikeInputs.
a381cf7
to
cd3ba5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just waiting for tests to run then will merge.
This makes sure that seeds are always set the same as well. Right now, setting a seed on a network does not actually guarantee it will be the same from one run to the next, because the splitter dictionaries change the order that everything gets built in in a non-deterministic way.