-
Notifications
You must be signed in to change notification settings - Fork 174
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
Add EnsembleArray.add_neuron_input/output. #868
Conversation
What if we just had |
Could do it that way. Just seems a bit magical, but maybe in a good way? |
I'll vote against that approach. I did it that way in |
warnings.warn( | ||
"'neuron_nodes' argument will be removed in Nengo 2.2. Use " | ||
"'add_neuron_input' and 'add_neuron_output' methods instead.", | ||
DeprecationWarning) |
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.
Add to #822.
My only concern is that |
I really don't think we want |
Yeah, I was mainly trying to motivate the logic for moving it into |
How would it work in |
Ah, I see... In that case I guess it's easier to make it consistent with |
The thing I don't like about that is people might think they have to call it each time to get the neuron output, and not realize it's adding lots of nodes (though the warning should help). |
Wouldn't that be clear enough from the name saying |
I guess the way @tbekolay has it now, it won't actually add a second neuron input or output, it will just give the warning and return. So we could just have it return the existing one there, and it'd be fine. @jgosmann, you're right that |
Added a fixup commit to address comments. |
nengo.Connection(net.gate, net.diff.neuron_input, | ||
transform=np.ones((n_total_neurons, 1)) * -10, | ||
synapse=None) | ||
|
||
# reset input (if reset=1, remove all values, and set to 0) | ||
net.reset = nengo.Node(size_in=1) | ||
net.mem.add_neuron_input() | ||
nengo.Connection(net.reset, net.mem.neuron_input, |
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.
Nit: could demonstrate the alternative of moving the above line net.mem.add_neuron_input()
to replace net.mem.neuron_input
.
LGTM |
LGTM too. When Travis passes I'll merge. |
Seems like something might be wrong with Travis. Job 2014 was terminated after hanging for 10 minutes? |
Looks like that job wasn't rebased to master, so it was still using a really slow NumPy. |
Also, warning to @hunse, pushed another commit to address the nit, and fix a typo I noticed in ensemblearray's docstring. |
Should this have a changelog? |
Oh dag, you right. Writing one now! |
Done. |
Previously, these both happened whenever `neuron_nodes=True` was passed in. However, there are occasions when you only want a neuron input (as occurred in `InputGatedMemory`) or only want a neuron output (for plotting a raster, for example). Additionally, adding these functions makes the `__init__` function a bit more readable. For the time being, I've kept `neuron_nodes` around as a shortcut to calling `add_neuron_input` and `add_neuron_output`. However, I've added a DeprecationWarning when it's set to True; we should remember to remove `neuron_nodes` in Nengo 2.2. I also redid the unit tests appropriately, and moved the EA.dimensions property up in the file, as I tend to expect all properties to be organized before all methods.
Previously, these both happened whenever
neuron_nodes=True
was passed in. However, there are occasions when you only want a neuron input (as occurred inInputGatedMemory
) or only want a neuron output (for plotting a raster, for example). Additionally, adding these functions makes the__init__
function a bit more readable.For the time being, I've kept
neuron_nodes
around as a shortcut to callingadd_neuron_input
andadd_neuron_output
. However, I've added a DeprecationWarning when it's set to True; we should remember to removeneuron_nodes
in Nengo 2.2.I also redid the unit tests appropriately, and moved the EA.dimensions property up in the file, as I tend to expect all properties to be organized before all methods.