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

Plateau Neuron - Fixed Point Model #781

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

kds300
Copy link
Contributor

@kds300 kds300 commented Sep 1, 2023

Issue Number: #775

Objective of pull request: Add Plateau neuron model to lava as described in the above issue.

Pull request checklist

Your PR fulfills the following requirements:

  • Issue created that explains the change and why it's needed
  • Tests are part of the PR (for bug fixes / features)
  • Docs reviewed and added / updated if needed (for bug fixes / features)
  • PR conforms to Coding Conventions
  • PR applys BSD 3-clause or LGPL2.1+ Licenses to all code files
  • Lint (flakeheaven lint src/lava tests/) and (bandit -r src/lava/.) pass locally
  • Build tests (pytest) passes locally

Pull request type

Please check your PR type:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation changes
  • Other (please describe):

What is the current behavior?

  • There is no current behavior, this is a new model.

What is the new behavior?

  • The model will take two separate inputs, one to the "soma" and another to the "dendrite". Both the soma and dendrite potentials will follow sub-threshold LIF dynamics. When the dendrite potential crosses its threshold it resets and sends the neuron to the UP state. The UP state will last for a specified duration of time steps. During this time, the soma is able to spike and reset if its potential crosses its threshold. If the neuron is in the DOWN state, the soma potential will follow subthreshold LIF dynamics regardless of whether it crosses the threshold.

Does this introduce a breaking change?

  • Yes
  • No

Supplemental information

@kds300 kds300 changed the title Plateau neuron Plateau Neuron - Fixed Point Model Sep 5, 2023
Signed-off-by: Marcus G K Williams <Marcus G K Williams [email protected]>
@mgkwill
Copy link
Contributor

mgkwill commented Oct 18, 2023

Hi @kds300, Thanks for this PR. Sorry it took us so long to take a look.

Pushed a PR to kds300#7 that should fix the codacy issues.

I will do more review in the next few days and I've added a few others for comment and review.

@mgkwill mgkwill requested a review from tim-shea October 18, 2023 06:55
from lava.magma.core.process.ports.ports import InPort, OutPort


class Plateau(AbstractProcess):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor point. Since this is a LIF neuron, did you consider to let it inherit from the AbstractLIF process, and adding a 'LIF' in the class name? Not sure if it makes sense in this specific example, though. Up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally didn't do this since I thought of it as two combined LIF neurons instead of a modified LIF neuron. I'll look over the AbstractLIF process and see if it makes sense to inherit from that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the class should inherit from AbstrictLIF, since it does not have current or bias vars.

0, 6400, 4800, 3600, 2700, 2025, 1518, 1138, 853, 639
]
self.assertListEqual(expected_v_dend, test_v_dend)
self.assertListEqual(expected_v_soma, test_v_soma)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if lintin passes?
'flakeheaven lint src/lava tests'

My guess is that there are a few points that must change, including missing lines at the end of files. Not functionally relevant, but important to keep a clean code base :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run the linting, (flakeheaven and bandit) and they pass on my local copy of the code. Also, I have the empty line at the end of the files locally, but it doesn't seem to show up on the github versions. Does github just not show the empty line at the end?


Precisions of state variables

- du_dend : unsigned 12-bit integer (0 to 4095)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the process, you specify that the variables are float. If you want them to be integers, I would specify that in the Process.
Also, is this model really using fixed point precision? Or is it bit accurate to Loihi?
In the later case, we tend to call it "...ModelBitAcc", rather than "...ModelFixed"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if bit-accurate would be appropriate for this, since I don't have a version of this that runs on Loihi. I tried to give the variables the same precision as on Loihi.

Precisions of state variables

- du_dend : unsigned 12-bit integer (0 to 4095)
- du_soma : unsigned 12-bit integer (0 to 4095)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note: On Loihi, variables typically have 8, 16, or 24 bit precision. Thus, you may want to avoid 12bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose 12-bit for the du and dv values since that was the precision of those values in the PyLifModelBitAcct. Since I'm choosing the precisions based on bit-accurate models, should I change this model to bit-accurate, as suggested in a different comment?

Copy link
Contributor

@phstratmann phstratmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Great code quality!

Just a few minor points I would ask you to change.

Please reach out if you have any questions.

@kds300
Copy link
Contributor Author

kds300 commented Oct 18, 2023

Thanks for your contribution. Great code quality!

Just a few minor points I would ask you to change.

Please reach out if you have any questions.

Thanks for the feedback! I'll go through code and make the requested changes.

@kds300
Copy link
Contributor Author

kds300 commented Oct 19, 2023

I updated my local branch with several of the recommended changes, and commented on some of the requested changes that I have questions about.

@kds300
Copy link
Contributor Author

kds300 commented Oct 19, 2023

Hi @kds300, Thanks for this PR. Sorry it took us so long to take a look.

Pushed a PR to kds300#7 that should fix the codacy issues.

I will do more review in the next few days and I've added a few others for comment and review.

@mgkwill Thanks for fixing the codacy issues! I'm still a bit new to github, especially using it collaboratively, so I had started making changes before merging that pull request. I added a commit to sort out some of the merge conflicts I created and then merged the pull request.

@kds300 kds300 requested a review from phstratmann November 9, 2023 20:44
Copy link
Contributor Author

@kds300 kds300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made most of the changes requested to the code.

There are two points I left unresolved:

  • Fixed vs BitAcct: I've modeled the behavior in a bit-acct way, but there is not an actual Nc implementation of this model.
  • Inheriting AbstractLIF: AbstractLIF has several attributes (u, bias_mant, etc.) which this model does not have, so I don't think it should inherit from that class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants