Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
242 commits
Select commit Hold shift + click to select a range
07464b7
create release branch
Jul 5, 2024
cf639ad
Merge pull request #60 from NACLab/dev
ago109 Jul 6, 2024
a1567cf
Merge pull request #61 from NACLab/main
ago109 Jul 6, 2024
f8aff77
Dev (#62)
willgebhardt Jul 8, 2024
d01314c
added block diag init to weight dist
ago109 Jul 9, 2024
06d6331
added block diag init to weight dist
ago109 Jul 9, 2024
49d20ba
added block diag init to weight dist; with will optimization
ago109 Jul 9, 2024
59049b0
slight extension to rate-cell for tensor-shaping
ago109 Jul 14, 2024
f4b81b2
slight extension to rate-cell for tensor-shaping
ago109 Jul 14, 2024
52f36ae
slight extension to rate-cell for tensor-shaping
ago109 Jul 14, 2024
18724fd
slightly modded bernoulli-cell help to reflect correct compartment names
Jul 17, 2024
4e33b4a
nudge to readme for minor version shift to beta2
ago109 Jul 22, 2024
8e4f9ab
nudge to readme for minor version shift to beta2
ago109 Jul 22, 2024
bdb0d43
mod to docs to prep for nudge to beta2
Jul 22, 2024
a0eea84
Merge pull request #64 from NACLab/main
ago109 Jul 22, 2024
bbf0330
nudge correctly to pip version beta3
Jul 22, 2024
c6d9e31
Merge pull request #65 from NACLab/main
ago109 Jul 22, 2024
1dee123
generalized rate-cell a bit
ago109 Jul 22, 2024
e72d75e
Merge branch 'main' of github.com:NACLab/ngc-learn
ago109 Jul 22, 2024
2189f51
touched up rate-cell further
ago109 Jul 23, 2024
23eb7ed
minor mod to lif
ago109 Jul 23, 2024
1ddd86d
updated lif-cell to use units/tags and minor cleanup and edits
ago109 Jul 23, 2024
e240644
Monitor plot (#66)
willgebhardt Jul 23, 2024
086bd4d
added meta-data to rate-cell, input encoders, adex
ago109 Jul 23, 2024
19bf502
fixed minor saving/loading in rate-cell w/ vectorized compartments
ago109 Jul 23, 2024
4e298db
Added auto resolving for monitors (#67)
willgebhardt Jul 23, 2024
22e0d3a
fixed surr arg in lif-cell
ago109 Jul 24, 2024
42167cb
Merge branch 'main' of github.com:NACLab/ngc-learn
ago109 Jul 24, 2024
05ea912
modded bernoulli-cell to include max-frequency constraint
ago109 Jul 24, 2024
c19d15e
added warning check to bernoulli, some cleanup
ago109 Jul 24, 2024
23a54f6
integrated if-cell, cleaned up lif and inits
ago109 Jul 24, 2024
27a61ef
mod to latency-cell
ago109 Jul 24, 2024
05a97f0
updated the poissonCell to be a true poisson
willgebhardt Jul 25, 2024
cdea291
Merge branch 'dynamics' of github.com:NACLab/ngc-learn into dynamics
willgebhardt Jul 25, 2024
efa61a5
fixed minor bug in deprecation for poiss/bern
ago109 Jul 25, 2024
223d3c0
fixed minor bug in deprecation for poiss/bern
ago109 Jul 25, 2024
9afaadf
fixed validation fun in bern/poiss
ago109 Jul 25, 2024
bf72094
moved back and cleaned up bernoulli and poisson cells
ago109 Jul 25, 2024
c894b8a
added threshold-clipping to latency cell
ago109 Jul 25, 2024
ba08453
updates to if/lif
ago109 Jul 26, 2024
9c932b1
added batch-size arg to slif
ago109 Jul 26, 2024
03940e9
fixed minor load bug in lif-cell
ago109 Jul 27, 2024
6bc5cd8
fixed a blocking jit-partial call in lif update_theta method; when lo…
Jul 27, 2024
f4c03a1
minor edit to dim-reduce
Jul 28, 2024
8d74157
Patched synapses added (#68)
Faezehabibi Aug 1, 2024
8d5bbd1
updated monitor plot code
willgebhardt Aug 6, 2024
97c4d92
update to dim-reduce
ago109 Aug 6, 2024
bf06510
update to dim-reduce with merge
ago109 Aug 6, 2024
77f347f
integrated phasor-cell, minor cleanup of latency
ago109 Aug 6, 2024
714a58c
tweak to adex thr arg
ago109 Aug 7, 2024
6ec2e7a
tweak to adex thr arg
ago109 Aug 7, 2024
fb8524a
integrated resonate-and-fire neuronal cell
ago109 Aug 8, 2024
dd49e5f
mod to raf-cell
ago109 Aug 8, 2024
8882208
cleaned up raf
ago109 Aug 8, 2024
ee50f33
cleaned up raf
ago109 Aug 8, 2024
611e5b3
cleaned up raf-cell
ago109 Aug 9, 2024
94f37f7
cleaned up raf-cell
ago109 Aug 9, 2024
73e5aa1
cleaned up raf-cell
ago109 Aug 9, 2024
6408ee0
minor tweak to dim-reduce in utils
Aug 11, 2024
da439bd
Fix typo in pcn_discrim.md (#69)
sonnygeorge Oct 7, 2024
7510bb3
model_utils and rate cell (#70)
Faezehabibi Oct 16, 2024
889d230
Fix/reorganize feature library (#74)
Faezehabibi Oct 25, 2024
7338c34
Update model_utils.py (#78)
Faezehabibi Nov 19, 2024
35eae76
Additions for inhibition stuff
willgebhardt Nov 19, 2024
94f1697
add sindy documentation for exhibits (#81)
Faezehabibi Dec 2, 2024
de53d20
Update ode_utils.py (#79)
Faezehabibi Dec 2, 2024
23473ab
Add patched synapse (#80)
Faezehabibi Dec 2, 2024
2295ba5
Update __init__.py (#83)
Faezehabibi Dec 6, 2024
eeb057a
Add l1 decay term to update calculation (#84)
Faezehabibi Dec 9, 2024
cf53968
feat NGC module regression (#86)
Faezehabibi Dec 9, 2024
c49daea
Update odes.py
Faezehabibi Dec 10, 2024
d5def75
Update odes.py (#87)
Faezehabibi Dec 10, 2024
21a8af0
Update odes.py
Faezehabibi Dec 10, 2024
537c29d
Update __init__.py
Faezehabibi Dec 10, 2024
34278ed
Update __init__.py
Faezehabibi Dec 10, 2024
0782fa6
Merge pull request #89 from Faezehabibi/fix-typo
rxng8 Dec 10, 2024
8b2730a
Merge branch 'NACLab:main' into refactor-odes
Faezehabibi Dec 10, 2024
9a3ce0e
Merge pull request #88 from Faezehabibi/refactor-odes
rxng8 Dec 10, 2024
da2f24e
Add attribute 'lr' (#90)
Faezehabibi Dec 16, 2024
796178d
commit probes/mods to utils to analysis_tools branch
Mar 1, 2025
84237ff
commit probes/mods to utils to analysis_tools branch
Mar 1, 2025
9d7acbb
update documentation
rxng8 Mar 1, 2025
247de74
cleaned up probes/docs for probes
Mar 1, 2025
d0df86e
change heads_dim to attn_dim, and modify the mlp to be as similar as …
rxng8 Mar 1, 2025
8a36e40
in layer normalization or any other Gaussian, standardeviation can ne…
rxng8 Mar 1, 2025
f402d98
update attentive probe code
rxng8 Mar 1, 2025
2a71b7f
minor tweak to attentive prob code comments
Mar 3, 2025
b688c6c
cleaned up probe parent fit routine
Mar 3, 2025
9ad4ae2
cleaned up probe parent fit routine
Mar 3, 2025
3a2de99
cleaned up probe parent fit routine
Mar 3, 2025
155d830
cleaned up probe parent fit routine
Mar 3, 2025
099c588
minor edits to attn probe
Mar 5, 2025
aeabf61
update attentive probe with input layer norm
rxng8 Mar 5, 2025
8682954
update input layer normalization
rxng8 Mar 6, 2025
dc8c127
update code to fix nan bug
rxng8 Mar 6, 2025
27fd9bf
minor tweak to attn probe
Mar 6, 2025
84005b5
cleaned up probes
Mar 6, 2025
2feeced
cleaned up probes
Mar 6, 2025
56f006c
cleaned up probes
Mar 6, 2025
1b7bff8
cleaned up probes
Mar 6, 2025
f38373f
generalized dropout in terms of shape
Mar 6, 2025
012395b
tweak to atten probe
Mar 6, 2025
53ed773
tweak to atten probe
Mar 6, 2025
1fbbf93
added silu/swish/elu to model_utils
Mar 6, 2025
23e8c84
cleaned up model_utils
Mar 6, 2025
695e9d8
fix bug in attention probe dropout, fix bug in None noise_key passed …
rxng8 Mar 7, 2025
04e1343
hyperparameter tunning arguments added
rxng8 Mar 10, 2025
b3418df
Merge branch 'main' into analysis_tools
rxng8 Mar 11, 2025
ffd8f0e
Merging over Dynamics feature branch to main (#92)
ago109 Mar 12, 2025
2d0452a
Merge branch 'main' into analysis_tools
ago109 Mar 12, 2025
7bfd8ac
remove unused local variables
rxng8 Mar 12, 2025
27ae7e2
update note
rxng8 Mar 12, 2025
92633f9
update model utils
rxng8 Mar 13, 2025
08b4d12
remove notes
rxng8 Mar 13, 2025
8f75b0d
Merge pull request #93 from NACLab/analysis_tools
rxng8 Mar 13, 2025
5664c64
Update ode utils (#94)
Faezehabibi Mar 13, 2025
36e8152
minor fix to header in diffeq
Mar 13, 2025
534ab67
Update files with ode_solver (#95)
Faezehabibi Mar 13, 2025
6e8261e
revised/cleaned up sindy tutorial doc/imgs
Mar 13, 2025
1d15f1f
add prior for hebbian patched synapse (#96)
Faezehabibi Mar 14, 2025
9de3c98
cleaned up doc-strings in odes.py to comply w/ ngc-learn format
Mar 17, 2025
0d720e1
minor tweak to sig-figs printing in probe utils
Mar 17, 2025
b9227f0
add-sigma-to-gaussianErrorCell (#97)
Faezehabibi Mar 20, 2025
4af85dc
cleaned up ode_utils, cleaned up gaussian/laplacian cell
Mar 20, 2025
7f3e7c8
Update gaussianErrorCell.py (#98)
Faezehabibi Mar 21, 2025
e055d95
cleaned up gauss/laplace error cells
Mar 21, 2025
b0b496a
integrated bernoulli err-cell
Mar 21, 2025
bbea397
Major release update merge to main (in prep for 2.0.0 release on rele…
ago109 Apr 12, 2025
54ec2dd
Major release update (to 2.0.0) (#100)
ago109 Apr 12, 2025
86b7189
Major release update merge to main (sync up) (#101)
ago109 Apr 12, 2025
20c81d2
update test cases
rxng8 Apr 12, 2025
e34b5ec
Nudging main v2.0.0 to release stage (formal release) (#102)
ago109 Apr 12, 2025
bbfe622
added hh-plot for hh tutorial
Apr 12, 2025
53a8f7f
Further nudge from main to release (#103)
ago109 Apr 12, 2025
214a6d3
tweak to img folder for sindy
Apr 12, 2025
0b07fff
Merge branch 'release' into main
ago109 Apr 12, 2025
fb5ddc4
update to sindy tutorial to adhere to readthedocs formatting
Apr 13, 2025
d5104ec
Merge branch 'main' of github.com:NACLab/ngc-learn
Apr 13, 2025
c3570de
Minor mods in release sync'd up back to main (#106)
ago109 Apr 13, 2025
061e713
minor edit to h-h text in modeling api doc
Apr 13, 2025
9fd17f1
Update jaxProcess.py
willgebhardt Apr 18, 2025
49bccb5
update to mstdp-et and var-trace
Apr 23, 2025
5396eb3
Merge branch 'main' of github.com:NACLab/ngc-learn
Apr 23, 2025
0182340
minor tweaks + init of rl-snn exhibit lesson
Apr 25, 2025
8f5a650
Dynamic synapses and updates to lessons (including operant conditioni…
ago109 Apr 29, 2025
1fe0d55
fixed exp-syn pytest
Apr 29, 2025
087d32a
Add tutorial diagram for GaussianErrorCells (#107)
Faezehabibi Apr 29, 2025
4d0cdff
Refactor patched synapse (#110)
Faezehabibi May 2, 2025
0419997
Add vis_mode to generate_patch_set (#111)
Faezehabibi May 6, 2025
276fbbb
cleaned up trace
May 22, 2025
a09a3c4
edit to requirements
May 24, 2025
91789a5
rename variables for masking (#112)
Faezehabibi May 29, 2025
cf7ee73
minor cleanup/patches to rate-cell/lif/hebb-syn/trace-stdp and dim_re…
Jun 4, 2025
2d8c6e4
Merge branch 'main' of github.com:NACLab/ngc-learn
Jun 4, 2025
1a8d26c
Updated model_utils.py with Telu (#114)
AnkurMali Jun 5, 2025
2213b7e
fixed v_decay naming bug in LIF
Jun 7, 2025
cf061dd
fixed v_decay naming bug in LIF
Jun 7, 2025
c186902
nudge minor version to 2.0.2
Jun 7, 2025
ffc94a5
nudge of doc to 2.0.2
Jun 7, 2025
08546b7
nudge of doc to 2.0.2 (#115)
ago109 Jun 7, 2025
4b7ed56
minor edit to math in hh-lesson doc
Jun 7, 2025
d85f040
Fix workflow, numpy install, and pytest bug in github action workflow…
rxng8 Jun 7, 2025
d8e52c8
minor nudge/cleanup to minor patched version 2.0.1
Jul 29, 2025
d748570
minor nudge/cleanup to minor patched version 2.0.3
Jul 29, 2025
208f820
Merge branch 'release' of github.com:NACLab/ngc-learn into release
Jul 29, 2025
488ec1e
Merge branch 'release' into main
ago109 Jul 29, 2025
9fd56ea
Nudge of release to minor patched version 2.0.3 (#118)
ago109 Jul 29, 2025
fdb2d98
Merge branch 'release' of github.com:NACLab/ngc-learn into release
Jul 29, 2025
26617aa
fixed typo/error in doc evolving_synapses.md
Jul 30, 2025
09be2fe
Merged back minor doc fix back to main (for syncing purposes) (#119)
ago109 Jul 30, 2025
f72bee8
minor clean-up in model_basics docs
Jul 30, 2025
4ddc60d
minor fixes/cleanup of docs
Jul 30, 2025
45d711c
Merge over further doc edits/clean-up from main (#120)
ago109 Jul 30, 2025
420e336
fixed typo in integration tutorial doc
Jul 30, 2025
75aadda
Minor merge (typo in integration doc) (#121)
ago109 Jul 30, 2025
9ce44f8
updated papers/talk page for ngclearn
Aug 1, 2025
c6547a8
Updated papers/talks page in docs (#122)
ago109 Aug 1, 2025
f658e4b
Merging over v3 to main (for roll-out of v3 upgrade) (#125)
ago109 Dec 6, 2025
1ef50ec
Merge branch 'release' into main
ago109 Dec 6, 2025
03bcf75
Major release update (to 3.0.0) (#127)
ago109 Dec 6, 2025
52e3fba
cleaned up return carriages in ode-integration doc
Dec 6, 2025
91cd96d
update to rbm/harmonium doc
Dec 6, 2025
2d567be
sync up release with main for harmonium/images
Dec 6, 2025
710d8b1
updated leaky-noise-cell to maintain temporal derivative of state
Dec 8, 2025
a8b156a
minor revisons/updates to hebb/dense syn, metric utils
Dec 8, 2025
f72a063
cleaned-up/revised leaky-noise-cell
Dec 8, 2025
d5b350a
cleaned-up/revised leaky-noise-cell
Dec 8, 2025
3c1fa61
Merge branch 'release' into main
ago109 Dec 8, 2025
054619b
Minor nudge to v3.0.1 (#129)
ago109 Dec 8, 2025
242f699
nudge release to v3.0.1
Dec 8, 2025
e15adc2
Merge back release nudge to main (sync to v3.0.1) (#130)
ago109 Dec 8, 2025
06cec92
minor revision of leaky-noise-cell
Dec 8, 2025
4a17152
Merge branch 'main' into release
ago109 Dec 8, 2025
b300492
Sync up of main with release (#131)
ago109 Dec 8, 2025
63a4e98
added pointer/stub for ei-rnn song-et-al in museum doc
Dec 8, 2025
71ad065
Move over minor update to main docs to release docs (#132)
ago109 Dec 8, 2025
1d70611
update to ei-rnn doc
Dec 8, 2025
0e0d324
Merge branch 'release' into main
ago109 Dec 8, 2025
4ed1d8f
update to ei-rnn arch fig
Dec 9, 2025
2b418c1
Merge branch 'main' of github.com:NACLab/ngc-learn
Dec 9, 2025
009ab50
added log-gaussian initializer to distribution_generator
Dec 9, 2025
b0a4193
bug-fix to log-gaussian func
Dec 9, 2025
2e2dd5e
Refactor patch utility functions and add doc strings (#136)
Faezehabibi Dec 13, 2025
3f848a8
Rao1999 hpc (#135)
Faezehabibi Dec 13, 2025
16f4293
fixed minor errors in pc-rao doc
Dec 13, 2025
d21e1a5
made revisions to pc-rao doc
Dec 13, 2025
40ac018
mod to pc-rao doc
Dec 13, 2025
07b36a4
update to docs
Dec 23, 2025
01fec02
minor revision to h-h doc-string
Dec 29, 2025
1ecadf8
added lkwta utility
Jan 9, 2026
eb89be5
Add retinal ganglion cell input encoder (#137)
Faezehabibi Jan 24, 2026
2fd70fc
Refactor patch synapse (#138)
Faezehabibi Jan 24, 2026
4f434f1
feat: Integrate MPSSynapse Component (#140)
antonvice Mar 16, 2026
79d2aab
integrated working som-synapse into competitive sub-package for synapses
Mar 21, 2026
970cb74
cleaned up som-syn
Mar 21, 2026
59afc24
update test code for hebbian patch synapse
rxng8 Mar 22, 2026
e9e6c75
fix SOM Synapse bug
rxng8 Mar 27, 2026
a9cf886
Flexible batch size (#142)
Faezehabibi Mar 31, 2026
4c355a8
cleaned up graded/patched comps with inner batched_reset formulation
Mar 31, 2026
969bb1b
minor clean-up of som-syn
Mar 31, 2026
64eb27d
claned up ganglion-cell, added batched_reset
Mar 31, 2026
1569e31
minor cleanup
Apr 1, 2026
dbd1029
added working hopfield-syn/modern-hopfield-syn
Apr 4, 2026
d6b1ecf
update SOM synapse to batchified version
rxng8 Apr 5, 2026
1362b11
integrated prototype for vector-quantize memory model/synapse
Apr 5, 2026
49ce5b9
wrote/integrated an ART2A synapse model, batch-generalized
Apr 5, 2026
be47ab0
updates to art2a, cleanup of probes
Apr 6, 2026
e1773db
updates to art2a, cleanup of probes
Apr 6, 2026
5097184
added in knn-probe for utils.analysis
Apr 6, 2026
d21fc65
cleaned up vq-synapse
Apr 7, 2026
ef8627a
cleaned up vq-synapse
Apr 7, 2026
6b78909
tweaked/cleaned-up gaussian-error-cell
Apr 15, 2026
5eb6180
Update JaxProcessesMixin.py
willgebhardt Apr 26, 2026
46fd684
minor patch fixes, including making .mask a compartment in key syn
Apr 28, 2026
3660cba
patch to bernoulli/latency and wtas cells
Apr 29, 2026
6386e71
update reset function of the ganglion cell
rxng8 May 1, 2026
c89c245
minor mod to model_utils
May 1, 2026
8a7b3f5
docs now with a few more mods
May 1, 2026
c802473
Merge branch 'dev' into main
ago109 May 1, 2026
70a49dd
patched pkg_resources and versioning items to prep for v3.1.0
May 1, 2026
66d5e19
cleaned up stdp-syn error in nudge
May 1, 2026
46ca16f
Merge branch 'dev' into main
ago109 May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ which implements several historical models, can be found
<a href="https://github.com/NACLab/ngc-museum">here</a>.

The official blog-post related to the source paper behind this software library
can be found
can be found
<a href="https://go.nature.com/3rgl1K8">here</a>.<br>
You can find the related paper <a href="https://www.nature.com/articles/s41467-022-29632-7">right here</a>, which
was selected to appear in the Nature <i>Neuromorphic Hardware and Computing Collection</i> in 2023 and was
chosen as one of the <i>Editors' Highlights for Applied Physics and Mathematics</i> in 2022.

<!--The technical report going over the theoretical underpinnings of the
NGC framework can be found here. TO BE RELEASED SOON. -->

## Installation

### Dependencies
Expand All @@ -42,7 +39,7 @@ ngc-learn requires:
-->

---
ngc-learn 3.0.0 and later require Python 3.10 or newer as well as ngcsimlib >=3.0.0.
ngc-learn 3.1.0 and later require Python 3.10 or newer as well as ngcsimlib >=3.0.0.
ngc-learn's plotting capabilities (routines within `ngclearn.utils.viz`) require
Matplotlib (>=3.8.0) and imageio (>=2.31.5) and both plotting and density estimation
tools (routines within ``ngclearn.utils.density``) will require Scikit-learn (>=0.24.2).
Expand Down Expand Up @@ -75,7 +72,7 @@ Python 3.11.4 (main, MONTH DAY YEAR, TIME) [GCC XX.X.X] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ngclearn
>>> ngclearn.__version__
'3.0.0'
'3.1.0'
```

<i>Note:</i> For access to the previous Tensorflow-2 version of ngc-learn (of
Expand Down Expand Up @@ -122,7 +119,7 @@ $ python install -e .
</pre>

**Version:**<br>
3.0.1 <!--1.2.3-Beta--> <!-- -Alpha -->
3.1.0 <!--1.2.3-Beta--> <!-- -Alpha -->

Author:
Alexander G. Ororbia II<br>
Expand Down
8 changes: 8 additions & 0 deletions docs/source/ngclearn.components.synapses.hebbian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ ngclearn.components.synapses.hebbian.BCMSynapse module
:undoc-members:
:show-inheritance:

ngclearn.components.synapses.hebbian.STDPSynapse module
-------------------------------------------------------

.. automodule:: ngclearn.components.synapses.hebbian.STDPSynapse
:members:
:undoc-members:
:show-inheritance:

ngclearn.components.synapses.hebbian.eventSTDPSynapse module
------------------------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ History
* integration/addition of RL-SNN model in model-museum
* integration of full dynamics synapses -- alpha, exponential, and double-exponential synaptic cables
* new metrics/clean-up of metrics in utils.metric_utils (e.g., KL divs, etc.)

3.1.0
— — — — — — — — -
* important patch made to ensure MethodProcess auto-jits (by default) - recovers ngc-learn's jax-driven speed
* new suite of competitive learning synapses (generalized formats), including vector-quantization, self-organizing map, adaptive resonance theory (contus-version), and modern hopfield network
* revisions to metric and model utils
* some additional clean-up, including supported retinal ganglion encoder

24 changes: 17 additions & 7 deletions ngclearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import sys
import pkg_resources
from pkg_resources import get_distribution

__version__ = get_distribution('ngclearn').version
if sys.version_info >= (3, 8): ## for new versions of python/ngc-learn
from importlib.metadata import version, distributions, PackageNotFoundError
else: ## for older versions of python before 3.8
from importlib_metadata import version, distributions, PackageNotFoundError
#import pkg_resources
#from pkg_resources import get_distribution
#__version__ = get_distribution('ngclearn').version

## Following obtains ngc-learn's version
from importlib.metadata import version
__version__ = version("ngclearn")

if sys.version_info.minor < 10:
import warnings
warnings.warn(
"Running ngclearn and jax in a python version prior to 3.10 may have unintended consequences. Compatibility "
"with python 3.8 is maintained to allow for lava-nc components and should only be used with those")

## Following obtains installed package names (as normalized keys) for ngc-learn
#required = {'ngcsimlib', 'jax', 'jaxlib'} ## list of core ngclearn dependencies
required = {'ngcsimlib'} #, 'jax', 'jaxlib'}
installed = {pkg.key for pkg in pkg_resources.working_set}
#installed = {pkg.key for pkg in pkg_resources.working_set}
#missing = required - installed
installed = {dist.metadata['Name'].lower().replace('-', '_') for dist in distributions()}
missing = required - installed

for key in required:
if key in missing:
raise ImportError(str(key) + ", a core dependency of ngclearn, is not " \
"currently installed!")


##################################################################################
## Needed to preload is called before anything in ngclearn
from pathlib import Path
from sys import argv
Expand All @@ -36,7 +46,7 @@
from ngcsimlib.parser import compilable
from ngcsimlib.operations import Summation, Product


## this prevents ngc-learn from messing with sphinx/building
if not Path(argv[0]).name == "sphinx-build" or Path(argv[0]).name == "build.py":
if "readthedocs" not in argv[0]: ## prevent readthedocs execution of preload
from ngcsimlib import configure
Expand Down
52 changes: 29 additions & 23 deletions ngclearn/components/synapses/hebbian/STDPSynapse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from jax import random, numpy as jnp, jit
from ngclearn import resolver, Component, Compartment
from ngclearn import compilable #from ngcsimlib.parser import compilable
from ngclearn import Compartment #from ngcsimlib.compartment import Compartment
from ngclearn.components.synapses import DenseSynapse
from ngclearn.utils import tensorstats

Expand Down Expand Up @@ -112,43 +113,48 @@ def _compute_update(Aplus, Aminus, tau_plus, tau_minus, preSpike, postSpike,
dW = (dWpost + dWpre)
return dW

@staticmethod
def _evolve(dt, w_bound, w_decay, tau_w, Aplus, Aminus, tau_plus, tau_minus, preSpike,
postSpike, pre_tols, post_tols, weights, eta):
@compilable
def evolve(self, t, dt):
weights = self.weights.get()
preSpike = self.preSpike.get()
postSpike = self.postSpike.get()
pre_tols = self.pre_tols.get()
post_tols = self.post_tols.get()
dWeights = STDPSynapse._compute_update(
Aplus, Aminus, tau_plus, tau_minus, preSpike, postSpike, pre_tols,
post_tols, weights
self.Aplus,
self.Aminus,
self.tau_plus,
self.tau_minus,
preSpike,
postSpike,
pre_tols,
post_tols,
weights
)
## shift/alter values of synaptic efficacies
if tau_w > 0.: ## triggers Euler-style synaptic update
weights = weights + (-weights * dt/tau_w + dWeights * eta)
else: ## raw simple ascent-style update
weights = weights + dWeights * eta - weights * w_decay
if self.tau_w > 0.: ## triggers Euler-style synaptic update
weights = weights + (-weights * dt / self.tau_w + dWeights * self.eta)
else: ## raw simple ascent-style update
weights = weights + dWeights * self.eta - weights * self.w_decay
## enforce non-negativity
eps = 0.001 # 0.01
weights = jnp.clip(weights, eps, w_bound - eps) # jnp.abs(w_bound))
return weights, dWeights
eps = 0.001 # 0.01
weights = jnp.clip(weights, eps, self.w_bound - eps) # jnp.abs(w_bound))

@resolver(_evolve)
def evolve(self, weights, dWeights):
self.weights.set(weights)
self.dWeights.set(dWeights)

@staticmethod
def _reset(batch_size, shape):
preVals = jnp.zeros((batch_size, shape[0]))
postVals = jnp.zeros((batch_size, shape[1]))
@compilable
def reset(self):
preVals = jnp.zeros((self.batch_size, self.shape[0]))
postVals = jnp.zeros((self.batch_size, self.shape[1]))
inputs = preVals
outputs = postVals
preSpike = preVals
postSpike = postVals
pre_tols = preVals
post_tols = postVals
dWeights = jnp.zeros(shape)
return inputs, outputs, preSpike, postSpike, pre_tols, post_tols, dWeights
dWeights = jnp.zeros(self.shape)

@resolver(_reset)
def reset(self, inputs, outputs, preSpike, postSpike, pre_tols, post_tols, dWeights):
self.inputs.set(inputs)
self.outputs.set(outputs)
self.preSpike.set(preSpike)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" # using setuptool building engine

[project]
name = "ngclearn"
version = "3.0.1"
version = "3.1.0"
description = "Simulation software for building and analyzing computational neuroscience models, brain-inspired computing systems, and NeuroAI agents."
authors = [
{name = "Alexander Ororbia", email = "ago@cs.rit.edu"},
Expand Down
Loading