Recent Releases of brainpy
brainpy - Version 2.6.0
New Features
This release provides several new features, including:
MLIRregistered operator customization interface inbrainpy.math.XLACustomOp.- Operator customization with CuPy JIT interface.
- Bug fixes.
What's Changed
- [doc] Fix the wrong path of more examples of
operator customized with taichi.ipynbby @Routhleck in https://github.com/brainpy/BrainPy/pull/612 - [docs] Add colab link for documentation notebooks by @Routhleck in https://github.com/brainpy/BrainPy/pull/614
- Update requirements-doc.txt to fix doc building temporally by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/617
- [math] Rebase operator customization using MLIR registration interface by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/618
- [docs] Add kaggle link for documentation notebooks by @Routhleck in https://github.com/brainpy/BrainPy/pull/619
- update requirements by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/620
- require
brainpylib>=0.2.6forjax>=0.4.24by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/622 - [tools] add
brainpy.tools.composeandbrainpy.tools.pipeby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/624 - doc hierarchy update by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/630
- Standardizing and generalizing object-oriented transformations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/628
- fix #626 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/631
- Fix delayvar not correct in concat mode by @CloudyDory in https://github.com/brainpy/BrainPy/pull/632
- [dependency] remove hard dependency of
taichiandnumbaby @Routhleck in https://github.com/brainpy/BrainPy/pull/635 clear_buffer_memory()support clearingarray,compilation, andnamesby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/639- add
brainpy.math.surrogate..Surrogateby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/638 - Enable brainpy object as pytree so that it can be applied with
jax.jitetc. directly by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/625 - Fix ci by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/640
- Clean taichi AOT caches by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/643
- [ci] Fix windows pytest fatal exception by @Routhleck in https://github.com/brainpy/BrainPy/pull/644
- [math] Support more than 8 parameters of taichi gpu custom operator definition by @Routhleck in https://github.com/brainpy/BrainPy/pull/642
- Doc for
brainpylib>=0.3.0by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/645 - Find back updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/646
- Update installation instruction by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/651
- Fix delay bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/650
- update doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/652
- [math] Add new customize operators with
cupyby @Routhleck in https://github.com/brainpy/BrainPy/pull/653 - [math] Fix taichi custom operator on gpu backend by @Routhleck in https://github.com/brainpy/BrainPy/pull/655
- update cupy operator custom doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/656
- version 2.6.0 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/657
- Upgrade CI by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/658
New Contributors
- @CloudyDory made their first contribution in https://github.com/brainpy/BrainPy/pull/632
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.5.0...V2.6.0
- Python
Published by chaoming0625 about 2 years ago
brainpy - Version 2.5.0
This release contains many new features and fixes. It is the first release with a mature solution for Brain Dynamics Operator Customization on both CPU and GPU platforms.
New Features
- Add synapse projection with Delta synapse models through
brainpy.dyn.HalfProjDeltaandbrainpy.dyn.FullProjDelta. - Add
brainpy.math.exprel, and change the code in the corresponding HH neuron models to improve numerical computation accuracy. These changes can significantly improve the numerical integration accuracy of HH-like models under x32 computation. - Add
brainpy.reset_level()decorator so that the state resetting order can be customized by users. - Add
brainpy.math.ein_rearrange,brainpy.math.ein_reduce, andbrainpy.math.ein_repeatfunctions - Add
brainpy.math.scantransformation. - Rebase all customized operators using Taichi JIT compiler. On the CPU platform, the speed performance can be boosted ten to hundred times. On the GPU platforms, the flexibility can be greatly improved.
- Many bug fixes.
- A new version of
brainpylib>=0.2.4has been released, supporting operator customization through the Taichi compiler. The supported backends include Linux, Windows, MacOS Intel, and MacOS M1 platforms. Tutorials please see https://brainpy.readthedocs.io/en/latest/tutorialadvanced/operatorcustomwithtaichi.html
What's Changed
- [docs] Add taichi customized operators tutorial by @Routhleck in https://github.com/brainpy/BrainPy/pull/545
- [docs] Optimize tutorial code in
operator_custom_with_taichi.ipynbof documentations by @Routhleck in https://github.com/brainpy/BrainPy/pull/546 - [running] fix multiprocessing bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/547
- [docs] Fix typo in docs by @Routhleck in https://github.com/brainpy/BrainPy/pull/549
- :arrow_up: Bump conda-incubator/setup-miniconda from 2 to 3 by @dependabot in https://github.com/brainpy/BrainPy/pull/551
- updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/550
brainpy.math.defjvpandbrainpy.math.XLACustomOp.defjvpby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/554- :arrow_up: Bump actions/setup-python from 4 to 5 by @dependabot in https://github.com/brainpy/BrainPy/pull/555
- Fix
brainpy.math.ifelsebugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/556 - [math & dyn] add
brainpy.math.exprel, and change the code in the corresponding HH neuron models to improve numerical computation accuracy by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/557 - Update README by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/558
- [doc] add conductance neuron model tutorial by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/559
- Doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/560
- add
brainpy.math.functional_vector_gradandbrainpy.reset_level()decorator by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/561 - [math] change the internal implementation of surrogate function by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/562
- Math by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/563
- [doc] update citations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/564
- add support for multi-class margin loss by @charlielam0615 in https://github.com/brainpy/BrainPy/pull/566
- Support for Delta synapse projections by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/568
- [math] Add taichi customized operators(event csrmv, csrmv, jitconn event mv, jitconn mv) by @Routhleck in https://github.com/brainpy/BrainPy/pull/553
- fix doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/571
- Fix default math parameter setting bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/572
- fix bugs in
brainpy.math.random.truncated_normalby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/574 - [doc] fix doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/576
- fix bugs in truncated_normal; add TruncatedNormal init. by @charlielam0615 in https://github.com/brainpy/BrainPy/pull/575
- [Dyn] Fix alpha synapse bugs by @ztqakita in https://github.com/brainpy/BrainPy/pull/578
- fix
brainpy.math.softplusandbrainpy.dnn.SoftPlusby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/581 - add
TruncatedNormaltoinitialize.pyby @charlielam0615 in https://github.com/brainpy/BrainPy/pull/583 - Fix
_format_shapeinrandom_inits.pyby @charlielam0615 in https://github.com/brainpy/BrainPy/pull/584 - fix bugs in
truncated_normalby @charlielam0615 in https://github.com/brainpy/BrainPy/pull/585 - [dyn] fix warning of reset_state by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/587
- [math] upgrade variable retrival by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/589
- [math & dnn] add
brainpy.math.unflattenandbrainpy.dnn.Unflattenby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/588 - [math] add
ein_rearrange,ein_reduce, andein_repeatfunctions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/590 - [math] Support taichi customized op with metal cpu backend by @Routhleck in https://github.com/brainpy/BrainPy/pull/579
- Doc fix and standardize Dual Exponential model again by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/591
- update doc, upgrade reset_state, update projection models by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/592
- [taichi] Make taichi caches more transparent and Add clean caches function by @Routhleck in https://github.com/brainpy/BrainPy/pull/596
- [test] remove test skip on macos, since brainpylib supports taichi interface on macos by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/597
- [dyn] add
clear_inputin thestep_runfunction. by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/601 - [math] Refactor taichi operators by @Routhleck in https://github.com/brainpy/BrainPy/pull/598
- [math] fix
brainpy.math.scanby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/604 disable_ jitsupport inbrainpy.math.scanby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/606- [math] Remove the logs that
taichi.init()print by @Routhleck in https://github.com/brainpy/BrainPy/pull/609 - Version control in Publish.yml CI by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/610
New Contributors
- @charlielam0615 made their first contribution in https://github.com/brainpy/BrainPy/pull/566
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.6...V2.5.0
- Python
Published by chaoming0625 over 2 years ago
brainpy - Version 2.4.6
This release contains more than 130 commit updates, and has provided several new features.
New Features
1. surrogate gradient functions are more transparent.
New instances can be used to compute the surrogate gradients. For example:
```python import brainpy.math as bm fun = bm.surrogate.Sigmoid()
forward function
spk = fun(membrane_potential)
backward function
dV = fun.surrogategrad(1., membranepotential)
surrogate forward function
surrospk = fun.surrogatefun(membrane_potential) ```
2. Add brainpy.math.eval_shape for evaluating the all dynamical variables used in the target function.
This function is similar to jax.eval_shape which has no FLOPs, while it can extract all variables used in the target function. For example:
```python net = ... # any dynamical system inputs = ... # inputs to the dynamical system variables, outputs= bm.eval_shape(net, inputs)
"variables" are all variables used in the target "net"
```
In future, this function will be used everywhere to transform all jax transformations into brainpy's oo transformations.
3. Generalize tools and interfaces for state managements.
For a single object:
- The .reset_state() defines the state resetting of all local variables in this node.
- The .load_state() defines the state loading from external disks (typically, a dict is passed into this .load_state() function).
- The .save_state() defines the state saving to external disks (typically, the .save_state() function generates a dict containing all variable values).
Here is an example to define a full class of brainpy.DynamicalSystem.
```python import brainpy as bp
class YouDynSys(bp.DynamicalSystem): def init(self, ): # define parameters self.par1 = .... self.num = ...
def resetstate(self, batchormode=None): # define variables self.a = bp.init.variable(bm.zeros, (self.num,), batchormode)
def loadstate(self, statedict): # load states from an external dict self.a.value = bm.asjax(statedict['a'])
def save_state(self): # save states as an external dict return {'a': self.a.value} ```
For a complex network model, brainpy provide unified state managment interface for initializing, saving, and loading states.
- The brainpy.reset_state() defines the state resetting of all variables in this node and its children nodes.
- The brainpy.load_state() defines the state loading from external disks of all variables in the node and its children.
- The brainpy.save_state() defines the state saving to external disks of all variables in the node and its children.
- The brainpy.clear_input() defines the clearing of all input variables in the node and its children.
4. Unified brain simulation and brain-inspired computing interface through automatic membrane scaling.
The same model used in brain simulation can be easily transformed into the one used for brain-inspired computing for training. For example,
```python class EINet(bp.DynSysGroup): def init(self): super().init() self.N = bp.dyn.LifRefLTC(4000, Vrest=-60., Vth=-50., Vreset=-60., tau=20., tauref=5., V_initializer=bp.init.Normal(-55., 2.)) self.delay = bp.VarDelay(self.N.spike, entries={'I': None}) self.E = bp.dyn.ProjAlignPost1( comm=bp.dnn.EventCSRLinear(bp.conn.FixedProb(0.02, pre=3200, post=4000), weight=bp.init.Normal(0.6, 0.01)), syn=bp.dyn.Expon(size=4000, tau=5.), out=bp.dyn.COBA(E=0.), post=self.N ) self.I = bp.dyn.ProjAlignPost1( comm=bp.dnn.EventCSRLinear(bp.conn.FixedProb(0.02, pre=800, post=4000), weight=bp.init.Normal(6.7, 0.01)), syn=bp.dyn.Expon(size=4000, tau=10.), out=bp.dyn.COBA(E=-80.), post=self.N )
def update(self, input): spk = self.delay.at('I') self.E(spk[:3200]) self.I(spk[3200:]) self.delay(self.N(input)) return self.N.spike.value
used for brain simulation
with bm.environment(mode=bm.nonbatching_mode): net = EINet()
used for brain-inspired computing
define the membrane_scaling parameter
with bm.environment(mode=bm.TrainingMode(128), membrane_scaling=bm.Scaling.transform([-60., -50.])): net = EINet() ```
5. New apis for operator customization on CPU and GPU devices through brainpy.math.XLACustomOp.
Starting from this release, brainpy introduces Taichi for operator customization. Now, users can write CPU and GPU operators through numba and taichi syntax on CPU device, and taichi syntax on GPu device. Particularly, to define an operator, user can use:
```python
import numba as nb import taichi as ti import numpy as np import jax import brainpy.math as bm
@nb.njit def numbacpufun(a, b, outa, outb): outa[:] = a outb[:] = b
@ti.kernel def taichigpufun(a, b, outa, outb): for i in range(a.size): outa[i] = a[i] for i in range(b.size): outb[i] = b[i]
prim = bm.XLACustomOp(cpukernel=numbacpufun, gpukernel=taichigpufun) a2, b2 = prim(np.random.random(1000), np.random.random(1000), outs=[jax.ShapeDtypeStruct(1000, dtype=np.float32), jax.ShapeDtypeStruct(1000, dtype=np.float32)])
```
6. Generalized STDP models which are compatible with diverse synapse models.
See https://github.com/brainpy/BrainPy/blob/master/brainpy/src/dyn/projections/tests/testSTDP.py
What's Changed
- [bug] fix compatible bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/508
- [docs] add low-level op customization by @ztqakita in https://github.com/brainpy/BrainPy/pull/507
- Compatible with
jax==0.4.16by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/511 - updates for parallelization support by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/514
- Upgrade surrogate gradient functions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/516
- [doc] update operator customization by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/517
- Updates for OO transforma and surrogate functions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/519
- [dyn] add neuron scaling by @ztqakita in https://github.com/brainpy/BrainPy/pull/520
- State saving, loading, and resetting by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/521
- [delay] rewrite previous delay APIs so that they are compatible with new brainpy version by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/522
- [projection] upgrade projections so that APIs are reused across different models by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/523
- [math] the interface for operator registration by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/524
- FIx bug in Delay by @ztqakita in https://github.com/brainpy/BrainPy/pull/525
- Fix bugs in membrane scaling by @ztqakita in https://github.com/brainpy/BrainPy/pull/526
- [math] Implement taichi op register by @Routhleck in https://github.com/brainpy/BrainPy/pull/527
- Link libtaichicapi.so when import brainpylib by @Routhleck in https://github.com/brainpy/BrainPy/pull/528
- update taichi op customization by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/529
- Fix error message by @HoshinoKoji in https://github.com/brainpy/BrainPy/pull/530
- [math] remove the hard requirement of
taichiby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/531 - [math] Resolve encoding of source kernel when ti.func is nested in ti… by @Routhleck in https://github.com/brainpy/BrainPy/pull/532
- [math] new abstract function for XLACustomOp, fix its bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/534
- [math] fix numpy array priority by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/533
- [brainpy.share] add category shared info by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/535
- [doc] update documentations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/536
- [doc] update doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/537
- [dyn] add
brainpy.reset_state()andbrainpy.clear_input()for more consistent and flexible state managements by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/538 - [math] simplify the taichi AOT operator customization interface by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/540
- [dyn] add
save_state,load_state,reset_state, andclear_inputhelpers by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/542 - [dyn] update STDP APIs on CPUs and fix bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/543
New Contributors
- @HoshinoKoji made their first contribution in https://github.com/brainpy/BrainPy/pull/530
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.5...V2.4.6
- Python
Published by chaoming0625 over 2 years ago
brainpy - Version 2.4.5
New Features
- A new version of
brainpylib==0.1.10has been released. In this release, we have fixed some bugs of brainpy dedicated GPU operators. Users can freely use them in any application. - Correspondingly, dedicated operators in
brainpy.mathhave been refined. .tracing_variable()has been created to support tracingVariables during computations and compilations. Example usage please see #472- Add a new random API for creating multiple random keys:
brainpy.math.random.split_keys(). - Fix bugs, including
brainpy.dnn.AllToAllmodule- RandomState.
brainpy.math.condandbrainpy.math.while_loopwhen variables are used in both branches
What's Changed
- Creat random key automatically when it is detected by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/461
- [encoding] upgrade encoding methods by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/464
- fix #466 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/467
- Update operators for compatible with
brainpylib>=0.1.10by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/468 - Support tracing
Variableduring computation and compilation by usingtracing_variable()function by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/472 - Add code of conduct and contributing guides by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/473
- add Funding and Development roadmap by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/475
- Create SECURITY.md by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/474
- Create dependabot.yml by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/476
- update maintainence info in README by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/479
- :arrow_up: Bump actions/setup-python from 2 to 4 by @dependabot in https://github.com/brainpy/BrainPy/pull/477
- :arrow_up: Bump actions/checkout from 2 to 4 by @dependabot in https://github.com/brainpy/BrainPy/pull/478
- ad acknowledgment.md by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/482
- update quickstart of
simulating a brain dynamics modelwith new APIs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/483 - update advanced tutorials by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/484
- [docs] Update installation.rst by @Routhleck in https://github.com/brainpy/BrainPy/pull/485
- update requirements by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/486
- [doc] update docs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/487
- [doc] update docs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/488
- Decouple Online and Offline training algorithms as
brainpy.mixin.SupportOnlineandbrainpy.mixin.SupportOfflineby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/489 - [dyn] add STDP_Song2000 LTP model by @ztqakita in https://github.com/brainpy/BrainPy/pull/481
- update STDP by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/491
- [doc] update the API of
brainpy.dynmodule & add synaptic plasticity module by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/492 - fix bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/493
- [math] fix bugs in
condandwhile_loopwhen same variables are used in both branches by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/494 - [docs] add BrainPy docker and docs by @ztqakita in https://github.com/brainpy/BrainPy/pull/496
- [docs] update README and installation by @ztqakita in https://github.com/brainpy/BrainPy/pull/499
- :arrow_up: Bump docker/build-push-action from 4 to 5 by @dependabot in https://github.com/brainpy/BrainPy/pull/498
- :arrow_up: Bump docker/login-action from 2 to 3 by @dependabot in https://github.com/brainpy/BrainPy/pull/497
- Add strings in bp.src.dyn.biomodels and abstract_models by @AkitsuFaye in https://github.com/brainpy/BrainPy/pull/500
- [reset] update logics of state reset in
DynamicalSystemby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/501 - [doc] upgrade docs with the latest APIs, fix #463 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/502
- [doc] add synapse model documentations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/503
- Changed the order of code blocks in the docs of hh models and lif models by @AkitsuFaye in https://github.com/brainpy/BrainPy/pull/505
- [mode] move recurrent models in brainpy.dnn model into
brainpy.dynmodule by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/506
New Contributors
- @dependabot made their first contribution in https://github.com/brainpy/BrainPy/pull/477
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.4...V2.4.5
- Python
Published by chaoming0625 over 2 years ago
brainpy - Version 2.4.4
This release has fixed several bugs and updated the sustainable documentation.
What's Changed
- [mixin] abstract the behavior of supporting input projection by
brainpy.mixin.ReceiveInputProjby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/428 - Update delays, models, and projections by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/429
- Compatible with
jax=0.4.14by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/431 - Add new tests by @yygf123 in https://github.com/brainpy/BrainPy/pull/430
- Add NonBatchingMode function by @yygf123 in https://github.com/brainpy/BrainPy/pull/433
- [connect] Complete
FixedTotalNumclass and fix bugs by @Routhleck in https://github.com/brainpy/BrainPy/pull/434 - Update the document "Concept 2: Dynamical System" by @yygf123 in https://github.com/brainpy/BrainPy/pull/435
- [docs] Update three part of tutorial toolbox by @Routhleck in https://github.com/brainpy/BrainPy/pull/436
- [docs] Update index.rst for surrogate gradient by @Routhleck in https://github.com/brainpy/BrainPy/pull/437
- Reconstruct BrainPy documentations by @ztqakita in https://github.com/brainpy/BrainPy/pull/438
- Renew doc requirements.txt by @ztqakita in https://github.com/brainpy/BrainPy/pull/441
- Compatibility updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/442
- update docs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/443
- Update optimizer by @yygf123 in https://github.com/brainpy/BrainPy/pull/451
- [docs] Update custom saving and loading by @Routhleck in https://github.com/brainpy/BrainPy/pull/439
- [doc] add new strings in bp.src.dyn.hh.py and bp.src.dyn.lif.py by @AkitsuFaye in https://github.com/brainpy/BrainPy/pull/454
- Serveral updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/452
- Update doc bug in index.rst by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/458
- add
brainpy.dyn.Alphasynapse model by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/459 - [doc] update ODE doc by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/460
New Contributors
- @AkitsuFaye made their first contribution in https://github.com/brainpy/BrainPy/pull/454
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.3...V2.4.4
- Python
Published by chaoming0625 almost 3 years ago
brainpy - Version 2.4.3
This release has standardized the modeling of DNN and SNN models by two intercorrelated packages: brainpy.dnn and brainpy.dyn.
Overall, the modeling of brain dynamics in this release has the following advantages:
- the automatic merging of the duplicate synapses, keeping the minimal device memory
- easy model and data parallelization across multiple devices
- easy integration with artificial neural networks
- a new abstraction that decouples dynamics from communication
- the unified
DynamicalSysteminterface
New Features
- Support to define ion channel models which rely on multiple ions. For example,
```python
class HH(bp.dyn.CondNeuGroup): def init(self, size): super().init(size) self.k = bp.dyn.PotassiumFixed(size) self.ca = bp.dyn.CalciumFirstOrder(size)
self.kca = bp.dyn.mix_ions(self.k, self.ca) # Ion that mixing Potassium and Calcium
self.kca.add_elem(ahp=bp.dyn.IAHP_De1994v2(size)) # channel that relies on both Potassium and Calcium
```
- New style
.update()function inbrainpy.DynamicalSystemwhich resolves all compatible issues. Starting from this version, allupdate()no longer needs to receive a global shared argument such astdi.
```python
class YourDynSys(bp.DynamicalSystem): def update(self, x): t = bp.share['t'] dt = bp.share['dt'] i = bp.share['i'] ...
```
Optimize the connection-building process when using
brainpy.conn.ScaleFreeBA,brainpy.conn.ScaleFreeBADual,brainpy.conn.PowerLawNew dual exponential model
brainpy.dyn.DualExponV2can be aligned with post dimension.More synaptic projection abstractions, including
brainpy.dyn.VanillaProjbrainpy.dyn.ProjAlignPostMg1brainpy.dyn.ProjAlignPostMg2brainpy.dyn.ProjAlignPost1brainpy.dyn.ProjAlignPost2brainpy.dyn.ProjAlignPreMg1brainpy.dyn.ProjAlignPreMg2
Fix compatible issues, fix unexpected bugs, and improve the model tests.
What's Changed
- [connect] Optimize the connector about ScaleFreeBA, ScaleFreeBADual, PowerLaw by @Routhleck in https://github.com/brainpy/BrainPy/pull/412
- [fix] bug of
connect.base.py'srequirefunction by @Routhleck in https://github.com/brainpy/BrainPy/pull/413 - Many Updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/414
- Update docs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/415
- fix conflict by @yygf123 in https://github.com/brainpy/BrainPy/pull/416
- add a new implementation of Dual Exponential Synapse model which can be aligned post. by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/417
- Enable test when pull requests by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/418
- Add random.seed() by @yygf123 in https://github.com/brainpy/BrainPy/pull/419
- Remove windows CI because it always generates strange errors by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/420
- Recent updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/421
- upgrade Runner and Trainer for new style of
DynamicalSystem.update()function by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/422 - update docs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/424
- fix
lifmodel bugs and support two kinds of spike reset:softandhardby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/423 - rewrite old synapses with decomposed components by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/425
- fix autograd bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/426
New Contributors
- @yygf123 made their first contribution in https://github.com/brainpy/BrainPy/pull/416
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.2...V2.4.3
- Python
Published by chaoming0625 almost 3 years ago
brainpy - Version 2.4.2
We are very excited to release this new version of BrainPy V2.4.2. In this new update, we cover several exciting features:
New Features
- Reorganize the model to decouple dynamics and communication.
- Add
brainpy.dynfor dynamics models andbrainpy.dnnfor the ANN layer and connection structures. - Supplement many docs for dedicated operators and common bugs of BrainPy.
- Fix many bugs.
What's Changed
- [ANN] add more activation functions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/379
- Optimize Gaussian Decay initializer by @Routhleck in https://github.com/brainpy/BrainPy/pull/381
- [update] new loss functions, surrograte base class, Array built-in functions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/383
- [parallelization] new module of
brainpy.pnnfor auto parallelization of brain models by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/385 - [fix] fix the bug of loading states by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/388
- [math] support
jax.disable_jit()for debugging by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/389 - [initialize] speed up
brainpy.init.DOGDecayby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/390 - [doc] fix doc build by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/391
- Add deprecations for deprecated APIs or functions by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/393
- [math] enable debugging for new style of transformations in BrainPy by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/392
- [math] flow control updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/396
- Test of rates by @shangyangli in https://github.com/brainpy/BrainPy/pull/386
- Add math docs: NumPy-like operations and Dedicated operators by @c-xy17 in https://github.com/brainpy/BrainPy/pull/395
- [doc] documentation about
how to debugandcommon gotchasby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/397 - Update requirements-doc.txt by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/399
- debug (images not displayed) by @c-xy17 in https://github.com/brainpy/BrainPy/pull/400
- Decouple dynamics and comminucations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/401
- [fix] bugs of control flows by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/404
- Test for channels, neurons and synapses. by @ztqakita in https://github.com/brainpy/BrainPy/pull/403
- Implement function to visualize connection matrix by @Routhleck in https://github.com/brainpy/BrainPy/pull/405
- Optimize GaussianProb by @Routhleck in https://github.com/brainpy/BrainPy/pull/406
- [dyn] add reduce models, HH-type models and channels by @ztqakita in https://github.com/brainpy/BrainPy/pull/408
- [dnn] add various linear layers by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/407
- [delay]
VariableDelayandDataDelayby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/409 - [dyn] add COBA examples using the interface of new
brainpy.dynmodule by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/410 - [dyn] Update dyn.neurons docs and fix several bugs by @ztqakita in https://github.com/brainpy/BrainPy/pull/411
New Contributors
- @shangyangli made their first contribution in https://github.com/brainpy/BrainPy/pull/386
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.1...V2.4.2
- Python
Published by ztqakita almost 3 years ago
brainpy - Version 2.4.1
New Features
- [math] Support the error report when modifying a
brainpy.math.Arrayduring compilation - [math] add
brainpy.math.event,brainpy.math.sparseandbrainpy.math.jitconnmodule, needsbrainpylib >= 0.1.9 - [interoperation] add apis and docs for
brainpy.layers.FromFlaxandbrainpy.layer.ToFlaxRNNCell - [fix] Bug fixes:
- fix WilsonCowan bug
- fix
brainpy.connect.FixedProbbug - fix analysis jit bug
What's Changed
- Update structures by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/364
- create blocksparse matrix matrix multiplication opearator by @Routhleck in https://github.com/brainpy/BrainPy/pull/365
- commit by @grysgreat in https://github.com/brainpy/BrainPy/pull/367
- Fix bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/368
- [math] update dedicated operators by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/370
- fix bugs by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/371
- [bug] fix merging bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/372
- [structure] update package structure by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/369
- [test] update csrmv tests by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/373
- [interoperation] add apis and docs for
brainpy.layers.FromFlaxandbrainpy.layer.ToFlaxRNNCellby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/374 - [doc] update documentation by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/375
- [bug] fix
brainpy.connect.FixedProbbug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/376 - [bug] fix analysis jit bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/377
- update brainpylib requirements by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/378
New Contributors
- @Routhleck made their first contribution in https://github.com/brainpy/BrainPy/pull/365
- @grysgreat made their first contribution in https://github.com/brainpy/BrainPy/pull/367
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.4.0...V2.4.1
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.4.0
This branch of releases (brainpy==2.4.x) are going to support the large-scale modeling for brain dynamics.
As the start, this release provides support for automatic object-oriented (OO) transformations.
What's New
- Automatic OO transformations on longer need to take
dyn_varsorchild_objsinformation. These transformations are capable of automatically inferring the underlying dynamical variables. Specifically, they include:
brainpy.math.gradand other autograd functionalitiesbrainpy.math.jitbrainpy.math.for_loopbrainpy.math.while_loopbrainpy.math.ifelsebrainpy.math.cond
- Update documentation
- Fix several bugs
What's Changed
- reorganize operators in
brainpy.mathby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/357 - Automatic transformations any function/object using
brainpy.math.Variableby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/358 - New OO transforms support
jax.disable_jitmode by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/359 - [oo transform] Enable new style of jit transformation to support
static_argnumsandstatic_argnamesby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/360 - [documentation] update documentation to brainpy>=2.4.0 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/361
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.3.8...V2.4.0
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.3.8
This release continues to add support for improving the usability of BrainPy.
New Features
- New data structures for object-oriented transformations.
NodeListandNodeDictfor a list/tuple/dict ofBrainPyObjectinstances.ListVarandDictVarfor a list/tuple/dict of brainpy data.
Cliptransformation for brainpy initializers.- All
brainpyliboperators are accessible inbrainpy.mathmodule. Especially there are some dedicated operators for scaling up the million-level neuron networks. For an example, see example in Simulating 1-million-neuron networks with 1GB GPU memory - Enable monitoring GPU models on CPU when setting
DSRunner(..., memory_efficient=True). This setting can usually reduce so much memory usage. brainpylibwheels on the Linux platform support the GPU operators. Users can install GPU version ofbrainpylib(requirebrainpylib>=0.1.7) directly bypip install brainpylib. @ztqakita
What's Changed
- Fix bugs and add more variable structures:
ListVarandDictVarby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/345 - add CI for testing various models by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/346
- Update docs and tests by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/347
- Fix
Runner(jit=False)` bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/348 - Compatible with jax>=0.4.7 by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/349
- Updates by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/350
- reconstruct BrainPy by merging brainpylib by @ztqakita in https://github.com/brainpy/BrainPy/pull/351
- Intergate brainpylib operators into brainpy by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/352
- fix
brainpylibcall bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/354 - Enable memory-efficient
DSRunnerby @chaoming0625 in https://github.com/brainpy/BrainPy/pull/355 - fix
Arraytransform bug by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/356
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.3.7...V2.3.8
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.3.7
- Fix bugs on population models in
brainpy.ratemodule - Fix bug on
brainpy.LoopOverTime - Add more synaptic models including DualExpoenetial model and Alpha model in
brainpy.experimentalmodule - Support call a module through right shift, such as
data >> module1 >> module2
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.3.6
This release continues to add support for brain-inspired computation.
New Features
More flexible customization of surrogate gradient functions.
- brainpy.math.surrogate.Sigmoid
- brainpy.math.surrogate.PiecewiseQuadratic
- brainpy.math.surrogate.PiecewiseExp
- brainpy.math.surrogate.SoftSign
- brainpy.math.surrogate.Arctan
- brainpy.math.surrogate.NonzeroSignLog
- brainpy.math.surrogate.ERF
- brainpy.math.surrogate.PiecewiseLeakyRelu
- brainpy.math.surrogate.SquarewaveFourierSeries
- brainpy.math.surrogate.S2NN
- brainpy.math.surrogate.QPseudoSpike
- brainpy.math.surrogate.LeakyRelu
- brainpy.math.surrogate.LogTailedRelu
- brainpy.math.surrogate.ReluGrad
- brainpy.math.surrogate.GaussianGrad
- brainpy.math.surrogate.InvSquareGrad
- brainpy.math.surrogate.MultiGaussianGrad
- brainpy.math.surrogate.SlayerGrad
Fix bugs
brainpy.LoopOverTime
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.3.5
This release continues to add support for brain-inspired computation.
New Features
1. brainpy.share for sharing data across submodules
In this release, we abstract the shared data as a brainpy.share object.
This object together with brainpy.Delay we will introduce below constitutes the support that enables us to define SNN models like ANN ones.
2. brainpy.Delay for delay processing
Delay is abstracted as a dynamical system, which can be updated/retrieved by users.
```python import brainpy as bp
class EINet(bp.DynamicalSystemNS): def init(self, scale=1.0, einput=20., iinput=20., delay=None): super().init()
self.bg_exc = e_input
self.bg_inh = i_input
# network size
num_exc = int(3200 * scale)
num_inh = int(800 * scale)
# neurons
pars = dict(V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.,
V_initializer=bp.init.Normal(-55., 2.), input_var=False)
self.E = bp.neurons.LIF(num_exc, **pars)
self.I = bp.neurons.LIF(num_inh, **pars)
# synapses
we = 0.6 / scale # excitatory synaptic weight (voltage)
wi = 6.7 / scale # inhibitory synaptic weight
self.E2E = bp.experimental.Exponential(
bp.conn.FixedProb(0.02, pre=self.E.size, post=self.E.size),
g_max=we, tau=5., out=bp.experimental.COBA(E=0.)
)
self.E2I = bp.experimental.Exponential(
bp.conn.FixedProb(0.02, pre=self.E.size, post=self.I.size, ),
g_max=we, tau=5., out=bp.experimental.COBA(E=0.)
)
self.I2E = bp.experimental.Exponential(
bp.conn.FixedProb(0.02, pre=self.I.size, post=self.E.size),
g_max=wi, tau=10., out=bp.experimental.COBA(E=-80.)
)
self.I2I = bp.experimental.Exponential(
bp.conn.FixedProb(0.02, pre=self.I.size, post=self.I.size),
g_max=wi, tau=10., out=bp.experimental.COBA(E=-80.)
)
self.delayE = bp.Delay(self.E.spike, entries={'E': delay})
self.delayI = bp.Delay(self.I.spike, entries={'I': delay})
def update(self): espike = self.delayE.at('E') ispike = self.delayI.at('I') einp = self.E2E(espike, self.E.V) + self.I2E(ispike, self.E.V) + self.bgexc iinp = self.I2I(ispike, self.I.V) + self.E2I(espike, self.I.V) + self.bginh self.delayE(self.E(einp)) self.delayI(self.I(iinp))
```
3. brainpy.checkpoints.save_pytree and brainpy.checkpoints.load_pytree for saving/loading target from the filename
Now we can directly use brainpy.checkpoints.save_pytree to save a network state into the file path we specified.
Similarly, we can use brainpy.checkpoints.load_pytree to load states from the given file path.
4. More ANN layers
- brainpy.layers.ConvTranspose1d
- brainpy.layers.ConvTranspose2d
- brainpy.layers.ConvTranspose3d
- brainpy.layers.Conv1dLSTMCell
- brainpy.layers.Conv2dLSTMCell
- brainpy.layers.Conv3dLSTMCell
5. More compatible dense operators
PyTorch operators:
- brainpy.math.Tensor
- brainpy.math.flatten
- brainpy.math.cat
- brainpy.math.abs
- brainpy.math.absolute
- brainpy.math.acos
- brainpy.math.arccos
- brainpy.math.acosh
- brainpy.math.arccosh
- brainpy.math.add
- brainpy.math.addcdiv
- brainpy.math.addcmul
- brainpy.math.angle
- brainpy.math.asin
- brainpy.math.arcsin
- brainpy.math.asinh
- brainpy.math.arcsin
- brainpy.math.atan
- brainpy.math.arctan
- brainpy.math.atan2
- brainpy.math.atanh
TensorFlow operators:
- brainpy.math.concat
- brainpy.math.reduce_sum
- brainpy.math.reduce_max
- brainpy.math.reduce_min
- brainpy.math.reduce_mean
- brainpy.math.reduce_all
- brainpy.math.reduce_any
- brainpy.math.reduce_logsumexp
- brainpy.math.reduce_prod
- brainpy.math.reduce_std
- brainpy.math.reduce_variance
- brainpy.math.reduceeuclideannorm
- brainpy.math.unsortedsegmentsqrt_n
- brainpy.math.segment_mean
- brainpy.math.unsortedsegmentsum
- brainpy.math.unsortedsegmentprod
- brainpy.math.unsortedsegmentmax
- brainpy.math.unsortedsegmentmin
- brainpy.math.unsortedsegmentmean
- brainpy.math.segment_sum
- brainpy.math.segment_prod
- brainpy.math.segment_max
- brainpy.math.segment_min
- brainpy.math.clipbyvalue
- brainpy.math.cast
Others
- Remove the hard requirements of
brainpylibandnumba.
- Python
Published by chaoming0625 about 3 years ago
brainpy - Version 2.3.4
This release mainly focuses on the compatibility with other frameworks:
- Fix Jax import error when
jax>=0.4.2 - Backward compatibility of
brainpy.dynmodule - Start to implement and be compatible with operators in pytorch and tensorflow, so that user's pytorch/tensorflow models can be easily migrated to brainpy
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.3.3...V2.3.4
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.3.3
Improve backward compatibility:
- monitors and inputs in
DSRunner - models in
brainpy.dyn - constants and function in
brainpy.analysis
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.3.2
This release (under the branch of brainpy=2.3.x) continues to add support for brain-inspired computation.
New Features
1. New package structure for stable API release
Unstable APIs are all hosted in brainpy._src module.
Other APIs are stable and will be maintained for a long time.
2. New schedulers
brainpy.optim.CosineAnnealingWarmRestartsbrainpy.optim.CosineAnnealingLRbrainpy.optim.ExponentialLRbrainpy.optim.MultiStepLRbrainpy.optim.StepLR
3. Others
- support
static_argnumsinbrainpy.math.jit - fix bugs of
reset_state()andclear_input()inbrainpy.channels - fix jit error checking
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.3.1
This release (under the release branch of brainpy=2.3.x) continues to add supports for brain-inspired computation.
python
import brainpy as bp
import brainpy.math as bm
Backwards Incompatible Changes
1. Error: module 'brainpy' has no attribute 'datasets'
brainpy.datasets module is now published as an independent package brainpy_datasets.
Please change your dataset access from
python
bp.datasets.xxxxx
to
```python import brainpydatasets as bpdata
bpdata.chaos.XXX bpdata.vision.XXX ```
For a chaotic data series,
```python
old version
data = bp.datasets.doublescrollseries(twarmup + ttrain + ttest, dt=dt) xvar = data['x'] yvar = data['y'] zvar = data['z']
new version
data = bd.chaos.DoubleScrollEq(twarmup + ttrain + ttest, dt=dt) xvar = data.xs yvar = data.ys zvar = data.zs ```
For a vision dataset,
```python
old version
dataset = bp.datasets.FashionMNIST(root, train=True, download=True)
new version
dataset = bd.vision.FashionMNIST(root, split='train', download=True) ```
2. Error: DSTrainer must receive an instance with BatchingMode
This error will happen when using brainpy.OnlineTrainer , brainpy.OfflineTrainer, brainpy.BPTT , brainpy.BPFF.
From version 2.3.1, BrainPy explicitly consider the computing mode of each model. For trainers, all training target should be a model with BatchingMode or TrainingMode.
If you are training model with OnlineTrainer or OfflineTrainer,
```python
old version
class NGRC(bp.DynamicalSystem): def init(self, numin): super(NGRC, self).init() self.r = bp.layers.NVAR(numin, delay=2, order=3) self.di = bp.layers.Dense(self.r.numout, numin)
def update(self, sha, x): di = self.di(sha, self.r(sha, x)) return x + di
new version
bm.setenviroment(mode=bm.batchingmode)
class NGRC(bp.DynamicalSystem): def init(self, numin): super(NGRC, self).init() self.r = bp.layers.NVAR(numin, delay=2, order=3) self.di = bp.layers.Dense(self.r.numout, numin, mode=bm.training_mode)
def update(self, sha, x): di = self.di(sha, self.r(sha, x)) return x + di ```
If you are training models with BPTrainer, adding the following line at the top of the script,
python
bm.set_enviroment(mode=bm.training_mode)
3. Error: inputsarebatching is no longer supported.
This is because if the training target is in batching mode, this has already indicated that the inputs should be batching.
Simple remove the inputs_are_batching from your functional call of .predict() will solve the issue.
New Features
1. brainpy.math module upgrade
brainpy.math.surrogate module for surrogate gradient functions.
Currently, we support
brainpy.math.surrogate.arctanbrainpy.math.surrogate.erfbrainpy.math.surrogate.gaussian_gradbrainpy.math.surrogate.inv_square_gradbrainpy.math.surrogate.leaky_relubrainpy.math.surrogate.log_tailed_relubrainpy.math.surrogate.multi_gaussian_gradbrainpy.math.surrogate.nonzero_sign_logbrainpy.math.surrogate.one_inputbrainpy.math.surrogate.piecewise_expbrainpy.math.surrogate.piecewise_leaky_relubrainpy.math.surrogate.piecewise_quadraticbrainpy.math.surrogate.q_pseudo_spikebrainpy.math.surrogate.relu_gradbrainpy.math.surrogate.s2nnbrainpy.math.surrogate.sigmoidbrainpy.math.surrogate.slayer_gradbrainpy.math.surrogate.soft_signbrainpy.math.surrogate.squarewave_fourier_series
New transformation function brainpy.math.to_dynsys
New transformation function brainpy.math.to_dynsys supports to transform a pure Python function into a DynamicalSystem. This will be useful when running a DynamicalSystem with arbitrary customized inputs.
```python import brainpy.math as bm
hh = bp.neurons.HH(1)
@bm.todynsys(childobjs=hh) def run_hh(tdi, x=None): if x is not None: hh.input += x
runner = bp.DSRunner(run_hhh, monitors={'v': hh.V}) runner.run(inputs=bm.random.uniform(3, 6, 1000)) ```
Default data types
Default data types brainpy.math.int_, brainpy.math.float_ and brainpy.math.complex_ are initialized according to the default x64 settings. Then, these data types can be set or get by brainpy.math.set_* or brainpy.math.get_* syntaxes.
Take default integer type int_ as an example,
```python
set the default integer type
bm.setint(jax.numpy.int64)
get the default integer type
a1 = bm.asarray([1], dtype=bm.int) a2 = bm.asarray([1], dtype=bm.getint()) # equivalent ```
Default data types are changed according to the x64 setting of JAX. For instance,
python
bm.enable_x64()
assert bm.int_ == jax.numpy.int64
bm.disable_x64()
assert bm.int_ == jax.numpy.int32
brainpy.math.float_ and brainpy.math.complex_ behaves similarly with brainpy.math.int_.
Environment context manager
This release introduces a new concept computing environment in BrainPy. Computing environment is a default setting for current computation jobs, including the default data type (int_, float_, complex_), the default numerical integration precision (dt), the default computing mode (mode). All models, arrays, and computations using the default setting will be carried out under the environment setting.
Users can set a default environment through
python
brainpy.math.set_environment(mode, dt, x64)
However, ones can also construct models or perform computation through a temporal environment context manager, this can be implemented through:
```python
constructing a HH model with dt=0.1 and x64 precision
with bm.environment(mode, dt=0.1, x64=True): hh1 = bp.neurons.HH(1)
constructing a HH model with dt=0.05 and x32 precision
with bm.environment(mode, dt=0.05, x64=False): hh2 = bp.neuron.HH(1) ```
Usually, users construct models for either brain-inspired computing (training mode) or brain simulation (nonbatching mode), therefore, there are shortcut context manager for setting a training environment or batching environment:
```python with bm.training_environment(dt, x64): pass
with bm.batching_environment(dt, x64): pass ```
2. brainpy.dyn module
brainpy.dyn.transfom module for transforming a DynamicalSystem instance to a callable BrainPyObject.
Specifically, we provide
LoopOverTimefor unrolling a dynamical system over time.NoSharedArgfor removing the dependency of shared arguments.
3. Running supports in BrainPy
All brainpy.Runner now are subclasses of BrainPyObject
This means that all brainpy.Runner can be used as a part of the high-level program or transformation.
Enable the continuous running of a differential equation (ODE, SDE, FDE, DDE, etc.) with IntegratorRunner.
For example,
```python import brainpy as bp
differential equation
a, b, tau = 0.7, 0.8, 12.5 dV = lambda V, t, w, Iext: V - V * V * V / 3 - w + Iext dw = lambda w, t, V: (V + a - b * w) / tau fhn = bp.odeint(bp.JointEq([dV, dw]), method='rk4', dt=0.1)
differential integrator runner
runner = bp.IntegratorRunner(fhn, monitors=['V', 'w'], inits=[1., 1.])
run 1
Iext, duration = bp.inputs.sectioninput([0., 1., 0.5], [200, 200, 200], returnlength=True) runner.run(duration, dynargs=dict(Iext=Iext)) bp.visualize.lineplot(runner.mon.ts, runner.mon['V'], legend='V')
run 2
Iext, duration = bp.inputs.sectioninput([0.5], [200], returnlength=True) runner.run(duration, dynargs=dict(Iext=Iext)) bp.visualize.lineplot(runner.mon.ts, runner.mon['V'], legend='V-run2', show=True)
```
Enable call a customized function during fitting of brainpy.BPTrainer.
This customized function (provided through fun_after_report) will be useful to save a checkpoint during the training. For instance,
```python class CheckPoint: def init(self, path='path/to/directory/'): self.max_acc = 0. self.path = path
def __call__(self, idx, metrics, phase):
if phase == 'test' and metrics['acc'] > self.max_acc:
self.max_acc = matrics['acc']
bp.checkpoints.save(self.path, net.state_dict(), idx)
trainer = bp.BPTT()
trainer.fit(..., funafterreport=CheckPoint())
```
Enable data with data_first_axis format when predicting or fitting in a brainpy.DSRunner and brainpy.DSTrainer.
Previous version of BrainPy only supports data with the batch dimension at the first axis. Currently, brainpy.DSRunner and brainpy.DSTrainer can support the data with the time dimension at the first axis. This can be set through data_first_axis='T' when initializing a runner or trainer.
python
runner = bp.DSRunner(..., data_first_axis='T')
trainer = bp.DSTrainer(..., data_first_axis='T')
4. Utility in BrainPy
brainpy.encoding module for encoding rate values into spike trains
Currently, we support
brainpy.encoding.LatencyEncoderbrainpy.encoding.PoissonEncoderbrainpy.encoding.WeightedPhaseEncoder
brainpy.checkpoints module for model state serialization.
This version of BrainPy supports to save a checkpoint of the model into the physical disk. Inspired from the Flax API, we provide the following checkpoint APIs:
brainpy.checkpoints.save()for saving a checkpoint of the model.brainpy.checkpoints.multiprocess_save()for saving a checkpoint of the model in multi-process environment.brainpy.checkpoints.load()for loading the last or best checkpoint from the given checkpoint path.brainpy.checkpoints.load_latest()for retrieval the path of the latest checkpoint in a directory.
Deprecations
1. Deprecations in the running supports of BrainPy
func_monitors is no longer supported in all brainpy.Runner subclasses.
We will remove its supports since version 2.4.0. Instead, monitoring with a dict of callable functions can be set in monitors. For example,
```python # old version
runner = bp.DSRunner(model, monitors={'sps': model.spike, 'vs': model.V}, func_monitors={'sp10': model.spike[10]}) ```
python
# new version
runner = bp.DSRunner(model,
monitors={'sps': model.spike,
'vs': model.V,
'sp10': model.spike[10]})
func_inputs is no longer supported in all brainpy.Runner subclasses.
Instead, giving inputs with a callable function should be done with inputs.
```python
old version
net = EINet()
def f_input(tdi): net.E.input += 10.
runner = bp.DSRunner(net, funinputs=finput, inputs=('I.input', 10.)) ```
```python
new version
def finput(tdi): net.E.input += 10. net.I.input += 10. runner = bp.DSRunner(net, inputs=finput) ```
inputs_are_batching is deprecated.
inputs_are_batching is deprecated in predict()/.run() of all brainpy.Runner subclasses.
args and dyn_args are now deprecated in IntegratorRunner.
Instead, users should specify args and dyn_args when using IntegratorRunner.run() function.
```python dV = lambda V, t, w, I: V - V * V * V / 3 - w + I dw = lambda w, t, V, a, b: (V + a - b * w) / 12.5 integral = bp.odeint(bp.JointEq([dV, dw]), method='exp_auto')
old version
runner = bp.IntegratorRunner( integral, monitors=['V', 'w'], inits={'V': bm.random.rand(10), 'w': bm.random.normal(size=10)}, args={'a': 1., 'b': 1.}, # CHANGE dynargs={'I': bp.inputs.rampinput(0, 4, 100)}, # CHANGE ) runner.run(100.,)
```
```python
new version
runner = bp.IntegratorRunner( integral, monitors=['V', 'w'], inits={'V': bm.random.rand(10), 'w': bm.random.normal(size=10)}, ) runner.run(100., args={'a': 1., 'b': 1.}, dynargs={'I': bp.inputs.rampinput(0, 4, 100)}) ```
2. Deprecations in brainpy.math module
ditype() and dftype() are deprecated.
brainpy.math.ditype() and brainpy.math.dftype() are deprecated. Using brainpy.math.int_ and brainpy.math.float() instead.
brainpy.modes module is now moved into brainpy.math
The correspondences are listed as the follows:
brainpy.modes.Mode=>brainpy.math.Modebrainpy.modes.NormalMode=>brainpy.math.NonBatchingModebrainpy.modes.BatchingMode=>brainpy.math.BatchingModebrainpy.modes.TrainingMode=>brainpy.math.TrainingModebrainpy.modes.normal=>brainpy.math.nonbatching_modebrainpy.modes.batching=>brainpy.math.batching_modebrainpy.modes.training=>brainpy.math.training_mode
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.3.0
This branch of releases aims to provide a unified computing framework for brain simulation and brain-inspired computing.
New features
brainpy.BPTTsupportstrain_dataandtest_datawith general Python iterators. For instance, one can train a model with PyTorch dataloader or TensorFlow datasets.
```python import torchvision from torch.utils.data import DataLoader data = torchvision.datasets.CIFAR10("./CIFAR10", train=False, transform=torchvision.transforms.ToTensor()) loader = DataLoader(dataset=data, batchsize=4, shuffle=True, numworkers=0, drop_last=False)
any generator can be used for traindata or testdata
trainer = bp.BPTT() trainer.fit(loader) ```
Consolidated object-oriented transformation in
brainpy.math.object_transformmodule. All brainpy transformations generate a newBrainPyObjectinstance so that objects in brainpy can be composed hierarchically.brainpy.math.to_object()transformation transforms a pure Python function into aBrainPyObject.New documentation is currently online for introducing the consolidated BrainPy concept of object-oriented transformation.
Change
brainpy.math.JaxArraytobrainpy.math.Array.
Deprecations
brainpy.datasetsmodule is no longer supported. New APIs will be moved intobrainpy-datasetspackage.brainpy.train.BPTTno longer support to receive the train data[X, Y]. Instead, users should provide a data generator such likepytorchdataset ortensorflowdataset.- The update function of
brainpy.math.TimeDealydoes not support receiving atimeindex. Instead, one can update the new data by directly usingTimeDealy.update(data)instead ofTimeDealy.update(time, data). - Fix the monitoring error of delay differential equations with
brainpy.integrators.IntegratorRunner.
Bug Fixes
- Fix the bug on
One2Oneconnection. - Fix the bug in
epropexample. - Fix
ij2csrtransformation error. - Fix test bugs
What's Changed
- fix eprop example error by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/305
- minor updates on API and DOC by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/306
- Add new optimizers by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/307
- add documentation of for random number generation by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/308
- consolidate the concept of OO transformation by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/309
- Upgrade documetations by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/310
- Ready for publish by @chaoming0625 in https://github.com/brainpy/BrainPy/pull/311
Full Changelog: https://github.com/brainpy/BrainPy/compare/V2.2.4.0...V2.3.0
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.4.0
This release has updated many functionalities and fixed several bugs in BrainPy.
New Features
- More ANN layers, including
brainpy.layers.Flattenandbrainpy.layers.Activation. - Optimized connection building for
brainpy.connectmodule. - cifar dataset.
- Enhanced API and Doc for parallel simulations via
brainpy.running.cpu_ordered_parallel,brainpy.running.cpu_unordered_parallel,brainpy.running.jax_vectorize_mapandbrainpy.running.jax_parallelize_map.
What's Changed
- add Activation and Flatten class by @LuckyHFC in https://github.com/PKU-NIP-Lab/BrainPy/pull/291
- optimizes the connect time when using gpu by @MamieZhu in https://github.com/PKU-NIP-Lab/BrainPy/pull/293
- datasets::vision: add cifar dataset by @hbelove in https://github.com/PKU-NIP-Lab/BrainPy/pull/292
- fix #294: remove VariableView in
dyn_varsof a runner by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/295 - update issue template by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/296
- add multiprocessing functions for batch running of BrainPy functions by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/298
- upgrade connection apis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/299
- fix #300: update parallelization api documentation by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/302
- update doc by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/303
New Contributors
- @LuckyHFC made their first contribution in https://github.com/PKU-NIP-Lab/BrainPy/pull/291
- @MamieZhu made their first contribution in https://github.com/PKU-NIP-Lab/BrainPy/pull/293
- @hbelove made their first contribution in https://github.com/PKU-NIP-Lab/BrainPy/pull/292
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.3.6...V2.2.4
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.3.6
- fix bifurcation analysis bug
- fix synaptic delay bug
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.3.4
New features
- This release removes the
extensionspackage, and deploys it as a standalone repository as brainpylib. - Initializing
brainpy.math.random.RandomStatewithseed_or_key, rather thanseed. - APIs in
brainpy.measuresupportsloopandvmapmethods, the former is memory-efficient, and the later is faster. - DNN layers are revised and are all useable.
- Upgrade operators to match
brainpylib>=0.1.1 brainpy.math.pre2post_event_sumsupports atuodiff (including JVP, VJP), it can be used for SNN training.
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.3.3...V2.2.3.4
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.3.2
This release continuously improves the functionality of BrainPy
New features
- Add
brainpy.measure.unitary_LFP()for calculating LFP from neuronal spikes
```python
import brainpy as bp runner = bp.DSRunner() runner.run(100) lfp = bp.measure.unitaryLFP(runner.mon.ts, runner.mon['exc.spike'], 'exc') lfp += bp.measure.unitaryLFP(runner.mon.ts, runner.mon['inh.spike'], 'inh') ```
- Add
brainpy.synapses.PoissonInputmodel
```python
bp.synapse.PoissonInput(targetvariable, numinput, freq, weight) ```
- Upgrade brainpy connection methods, improving its speeds. New customization of brainpy
Connectorcan be implemented through
```python
class YourConnector(bp.conn.TwoEndConnector): def build_csr(self): pass
def build_coo(self): pass
def build_mat(self): pass ```
Improvements
Support transformation contexts for
JaxArray, and improve the error checking of JaxArray updating in a JIT function.Speedup delay retrieval by reversing delay variable data.
Improve the operator customization methods by using Numba functions.
Fix bugs in GPU operators in
brainpylib.
What's Changed
- Docs: add compile_brainpylib documentation by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/270
- add
PoissonInputmodel andunitary_LFP()method by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/271 - organize brainpylib for future extensions by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/272
- Update lowdim analyzer by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/273
- speedup connections in One2One, All2All, GridFour, GridEight, and others by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/274
- consistent brainpylib with brainpy operators by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/275
- Fix test bugs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/276
- Fixed setup mac script by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/278
- JaxArray transformation context by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/277
- speedup delay retrieval by reversing delay variable data by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/279
- Updating apis for connections and operation registeration by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/280
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.3.1...V2.2.3.2
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.3.1
This release fixes the installation on Windows systems and improves the installation guides in the official documentation and installation process.
The following example shows how to install jaxlib after users install and import brainpy:
```python
import brainpy Traceback (most recent call last): File "
", line 1, in File "C:\Users\adadu\miniconda3\envs\py3test\lib\site-packages\brainpy_init_.py", line 10, in raise ModuleNotFoundError(
BrainPy needs jaxlib, please install jaxlib.
- If you are using Windows system, install jaxlib through
pip install jaxlib -f https://whls.blob.core.windows.net/unstable/index.html
- If you are using macOS platform, install jaxlib through
pip install jaxlib -f https://storage.googleapis.com/jax-releases/jax_releases.html
- If you are using Linux platform, install jaxlib through
pip install jaxlib -f https://storage.googleapis.com/jax-releases/jax_releases.html
- If you are using Linux + CUDA platform, install jaxlib through
pip install jaxlib -f https://storage.googleapis.com/jax-releases/jaxcudareleases.html
Note that the versions of "jax" and "jaxlib" should be consistent, like "jax=0.3.14", "jaxlib=0.3.14".
More detail installation instruction, please see https://brainpy.readthedocs.io/en/latest/quickstart/installation.html#dependency-2-jax
```
Hope this information may help the installation of BrainPy much easiler.
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.3
This release continues to improve the usability of BrainPy.
New Features
Operations among a
JaxArrayand a NumPyndarrayin a JIT function no longer cause errors. ```pythonimport numpy as np import brainpy.math as bm f = bm.jit(lambda: bm.random.random(3) + np.ones(1)) f JaxArray([1.2022058, 1.683937 , 1.3586301], dtype=float32) ```
Initializing a
brainpy.math.Variableaccording to the data shape.
```python
bm.Variable(10, dtype=bm.float32) Variable([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32) ```
LengthDelaysupports a new method called"concatenate"which is compatible with BP training.
```python
delay = bm.LengthDelay(bm.ones(3), 10, update_method='concatenate') delay.update(bm.random.random(3)) delay.retrieve(0) DeviceArray([0.17887115, 0.6738142 , 0.75816643], dtype=float32) delay.retrieve(10) DeviceArray([0., 0., 0.], dtype=float32) ```
Note that compared with the default updating method "rotation", this method can be used to train delay models with BP algorithms. However, "concatenate" has a slower speed for delay processing.
- Support customizing the plotting styles of fixed points. However, there is still work to support flexible plotting of analyzed results.
```python
from brainpy.analysis import plotstyle, stability plotstyle.setplotschema(stability.SADDLE_NODE, marker='*', markersize=15) ```
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.2...V2.2.3
What's Changed
- Update installation info and delay apis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/263
- Support initializing a Variable by data shape by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/265
- operations with JaxArray and numpy ndarray do not cause errors by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/266
- Update
VariableViewand analysis plotting apis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/268
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.2...V2.2.3
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.2
Bug Fixes
This release fixes several bugs in the BrainPy system, including:
- The jitted functions in
brainpy.measuremodule no longer exists when they are cleared bybrainpy.math.clear_memory_buffer(). - The bug for
clear_input()function. - The bug for the monitor in
brainpy.integrators.IntegratorRunner
What's Changed
- update loop docs and apis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/261
- fix some bugs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/262
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.2.1...V2.2.2
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.1
This release fixes bugs found in the codebase and improves the usability and functions of BrainPy.
Bug fixes
- Fix the bug of operator customization in
brainpy.math.XLACustomOpandbrainpy.math.register_op. Now, it supports operator customization by using NumPy and Numba interface. For instance, ```python import brainpy.math as bm
def abseval(events, indices, indptr, postval, values): return post_val
def concompute(outs, ins): postval = outs events, indices, indptr, , values = ins for i in range(events.size): if events[i]: for j in range(indptr[i], indptr[i + 1]): index = indices[j] oldvalue = postval[index] postval[index] = values + old_value
eventsum = bm.XLACustomOp(evalshape=abseval, concompute=con_compute) ```
- Fix the bug of
brainpy.tools.DotDict. Now, it is compatible with the transformations of JAX. For instance, ```python import brainpy as bp from jax import vmap
@vmap def multiplerun(I): hh = bp.neurons.HH(1) runner = bp.dyn.DSRunner(hh, inputs=('input', I), numpymonafterrun=False) runner.run(100.) return runner.mon
mon = multiple_run(bp.math.arange(2, 10, 2)) ```
New features
- Add numpy operators
brainpy.math.mat,brainpy.math.matrix,brainpy.math.asmatrix. - Improve translation rules of brainpylib operators, improve its running speeds.
- Support
DSViewofDynamicalSysteminstance. Now, it supports defining models with a slice view of a DS instance. For example, ```python import brainpy as bp import brainpy.math as bm
class EINetV2(bp.dyn.Network): def _init(self, scale=1.0, method='expauto'): super(EINetV2, self).init__()
# network size
num_exc = int(3200 * scale)
num_inh = int(800 * scale)
# neurons
self.N = bp.neurons.LIF(num_exc + num_inh,
V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.,
method=method, V_initializer=bp.initialize.Normal(-55., 2.))
# synapses
we = 0.6 / scale # excitatory synaptic weight (voltage)
wi = 6.7 / scale # inhibitory synaptic weight
self.Esyn = bp.synapses.Exponential(pre=self.N[:num_exc], post=self.N,
conn=bp.connect.FixedProb(0.02),
g_max=we, tau=5.,
output=bp.synouts.COBA(E=0.),
method=method)
self.Isyn = bp.synapses.Exponential(pre=self.N[num_exc:], post=self.N,
conn=bp.connect.FixedProb(0.02),
g_max=wi, tau=10.,
output=bp.synouts.COBA(E=-80.),
method=method)
net = EINetV2(scale=1., method='expauto')
simulation
runner = bp.dyn.DSRunner( net, monitors={'spikes': net.N.spike}, inputs=[(net.N.input, 20.)] ) runner.run(100.)
visualization
bp.visualize.raster_plot(runner.mon.ts, runner.mon['spikes'], show=True) ```
- Python
Published by chaoming0625 over 3 years ago
brainpy - Version 2.2.0
This release has provided important improvements for BrainPy, including usability, speed, functions, and others.
Backwards Incompatible changes
brainpy.nnmodule is no longer supported and has been removed since version 2.2.0. Instead, users should usebrainpy.trainmodule for the training of BP algorithms, online learning, or offline learning algorithms, andbrainpy.algorithmsmodule for online / offline training algorithms.- The
update()function for the model definition has been changed:
```python
2.1.x
import brainpy as bp
class SomeModel(bp.dyn.DynamicalSystem): def init(self, ): ...... def update(self, t, dt): pass ```
```python
2.2.x
import brainpy as bp
class SomeModel(bp.dyn.DynamicalSystem): def init(self, ): ...... def update(self, tdi): t, dt = tdi.t, tdi.dt pass ```
where tdi can be defined with other names, like sha, to represent the shared argument across modules.
Deprecations
brainpy.dyn.xxx (neurons)andbrainpy.dyn.xxx (synapse)are no longer supported. Please usebrainpy.neurons,brainpy.synapsesmodules.brainpy.running.monitorhas been removed.brainpy.nnmodule has been removed.
New features
brainpy.math.Variablereceives abatch_axissetting to represent the batch axis of the data. ```pythonimport brainpy.math as bm a = bm.Variable(bm.zeros((1, 4, 5)), batchaxis=0) a.value = bm.zeros((2, 4, 5)) # success a.value = bm.zeros((1, 2, 5)) # failed MathError: The shape of the original data is (2, 4, 5), while we got (1, 2, 5) with batchaxis=0. ```
brainpy.trainprovidesbrainpy.train.BPTTfor back-propagation algorithms,brainpy.train.Onlinetrainerfor online training algorithms,brainpy.train.OfflineTrainerfor offline training algorithms.brainpy.Baseclass supports_excluded_varssetting to ignore variables when retrieving variables by usingBase.vars()method. ```pythonclass OurModel(bp.Base): excludedvars = ('a', 'b') def init(self): super(OurModel, self).init() self.a = bm.Variable(bm.zeros(10)) self.b = bm.Variable(bm.ones(20)) self.c = bm.Variable(bm.random.random(10))
model = OurModel() model.vars().keys() dict_keys(['OurModel0.c']) ```
brainpy.analysis.SlowPointFindersupports directly analyzing an instance ofbrainpy.dyn.DynamicalSystem. ```python
hh = bp.neurons.HH(1) finder = bp.analysis.SlowPointFinder(hh, targetvars={'V': hh.V, 'm': hh.m, 'h': hh.h, 'n': hh.n})
5. ``brainpy.datasets`` supports MNIST, FashionMNIST, and other datasets. 6. Supports defining conductance-based neuron models``.python class HH(bp.dyn.CondNeuGroup): def _init(self, size): super(HH, self).init__(size)self.INa = channels.INa_HH1952(size, ) self.IK = channels.IK_HH1952(size, ) self.IL = channels.IL(size, E=-54.387, g_max=0.03)
7. ``brainpy.layers`` module provides commonly used models for DNN and reservoir computing. 8. Support composable definition of synaptic models by using ``TwoEndConn``, ``SynOut``, ``SynSTP`` and ``SynLTP``.pythonbp.synapses.Exponential(self.E, self.E, bp.conn.FixedProb(prob), gmax=0.03 / scale, tau=5, output=bp.synouts.COBA(E=0.), stp=bp.synplast.STD()) ``
9. Provide commonly used surrogate gradient function for spiking generation, including -brainpy.math.spikewithsigmoidgrad-brainpy.math.spikewithlineargrad-brainpy.math.spikewithgaussiangrad-brainpy.math.spikewithmggrad10. Provide shortcuts for GPU memory management via`brainpy.math.disablegpumemorypreallocation(), andbrainpy.math.clearbuffermemory()``.
What's Changed
- fix #207: synapses update first, then neurons, finally delay variables by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/219
- docs: add logos by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/218
- Add the biological NMDA model by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/221
- docs: fix mathjax problem by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/222
- Add the parameter R to the LIF model by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/224
- new version of brainpy: V2.2.0-rc1 by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/226
- update training apis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/227
- Update quickstart and the analysis module by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/229
- Eseential updates for montors, analysis, losses, and examples by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/230
- add numpy op tests by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/231
- Integrated simulation, simulaton and analysis by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/232
- update docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/233
- unify
brainpy.layerswith other modules inbrainpy.dynby @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/234 - fix bugs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/235
- update apis, docs, examples and others by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/236
- fixes by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/237
- fix: add dtype promotion = standard by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/239
- updates by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/240
- update training docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/241
- change doc path/organization by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/242
- Update advanced docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/243
- update quickstart docs & enable jit error checking by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/244
- update apis and examples by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/245
- update apis and tests by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/246
- Docs update and bugs fixed by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/247
- version 2.2.0 by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/248
- add norm and pooling & fix bugs in operators by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/249
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.12...V2.2.0
- Python
Published by chaoming0625 almost 4 years ago
brainpy - Version 2.1.12
Highlights
This release is excellent. We have made important improvements.
- We provide dozens of random sampling in NumPy which are not supportted in JAX, such as
brainpy.math.random.bernoulli,brainpy.math.random.lognormal,brainpy.math.random.binomial,brainpy.math.random.chisquare,brainpy.math.random.dirichlet,brainpy.math.random.geometric,brainpy.math.random.f,brainpy.math.random.hypergeometric,brainpy.math.random.logseries,brainpy.math.random.multinomial,brainpy.math.random.multivariate_normal,brainpy.math.random.negative_binomial,brainpy.math.random.noncentral_chisquare,brainpy.math.random.noncentral_f,brainpy.math.random.power,brainpy.math.random.rayleigh,brainpy.math.random.triangular,brainpy.math.random.vonmises,brainpy.math.random.wald,brainpy.math.random.weibull - make efficient checking on numerical values. Instead of direct
id_tap()checking which has large overhead, currentlybrainpy.tools.check_erro_in_jit()is highly efficient. - Fix
JaxArrayoperator errors onNone - improve oo-to-function transformation speeds
ioworks:.save_states()and.load_states()
What's Changed
- support dtype setting in array interchange functions by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/209
- fix #144: operations on None raise errors by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/210
- add tests and new functions for random sampling by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/213
- feat: fix
iofor brainpy.Base by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/211 - update advanced tutorial documentation by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/212
- fix #149 (dozens of random samplings in NumPy) and fix JaxArray op errors by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/216
- feat: efficient checking on numerical values by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/217
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.11...V2.1.12
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.11
What's Changed
- fix: cross-correlation bug by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/201
- update apis, test and docs of numpy ops by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/202
- docs: add sphinxbooktheme by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/203
- fix: add requirements-doc.txt by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/204
- update contro flow, integrators, operators, and docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/205
- improve oo-to-function transformation speed by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/208
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.10...V2.1.11
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.10
- Fix bugs on synapse delay
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.9...V2.1.10
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.9
What's Changed
- update control flow APIs and Docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/192
- doc: update docs of dynamics simulation by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/193
- fix #125: add channel models and two-compartment Pinsky-Rinzel model by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/194
- JIT errors do not change Variable values by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/195
- fix a bug in math.activations.py by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/196
- Functionalinaty improvements by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/197
- update rate docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/198
- update brainpy.dyn doc by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/199
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.8...V2.1.9
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.8
What's Changed
- Fix #120 by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/178
- feat: brainpy.Collector supports addition and subtraction by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/179
- feat: delay variables support "indices" and "reset()" function by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/180
- Support reset functions in neuron and synapse models by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/181
update()function on longer need_tand_dtby @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/183- small updates by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/188
- feat: easier control flows with
brainpy.math.ifelseby @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/189 - feat: update delay couplings of
DiffusiveCouplingandAdditiveCoupingby @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/190 - update version and changelog by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/191
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.7...V2.1.8
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.7
What's Changed
- synapse models support heterogeneuos weights by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/170
- more efficient synapse implementation by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/171
- fix input models in brainpy.dyn by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/172
- fix: np array astype by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/173
- update README: 'brain-py' to 'brainpy' by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/174
- fix: fix the updating rules in the STP model by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/176
- Updates and fixes by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/177
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.5...V2.1.7
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.5
What's Changed
brainpy.math.random.shuffleis numpy like by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/153- update LICENSE by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/155
- docs: add m1 warning by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/154
- compatible apis of 'brainpy.math' with those of 'jax.numpy' in most modules by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/156
- Important updates by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/157
- Updates by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/159
- Add LayerNorm, GroupNorm, and InstanceNorm as nn_nodes in normalization.py by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/162
- feat: add conv & pooling nodes by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/161
- fix: update setup.py by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/163
- update setup.py by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/165
- fix: change trigger condition by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/166
- fix: add build_conn() function by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/164
- update synapses by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/167
- get the deserved name: brainpy by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/168
- update tests by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/169
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.4...V2.1.5
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.4
What's Changed
- fix doc parsing bug by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/127
- Update overviewofdynamic_model.ipynb by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/129
- Reorganization of
brainpylib.custom_opand adding interface inbrainpy.mathby @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/128 - Fix: modify
register_opand brainpy.math interface by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/130 - new features about RNN training and delay differential equations by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/132
- Fix #123: Add low-level operators docs and modify register_op by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/134
- feat: add generate_changelog by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/135
- fix #133, support batch size training with offline algorithms by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/136
- fix #84: support online training algorithms by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/137
- feat: add the batch normalization node by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/138
- fix: fix shape checking error by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/139
- solve #131, support efficient synaptic computation for special connection types by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/140
- feat: update the API and test for batch normalization by @c-xy17 in https://github.com/PKU-NIP-Lab/BrainPy/pull/142
- Node is default trainable by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/143
- Updates training apis and docs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/145
- fix: add dependencies and update version by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/147
- update requirements by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/146
- data pass of the Node is default SingleData by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/148
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.3...V2.1.4
- Python
Published by ztqakita about 4 years ago
brainpy - Version 2.1.3
This release improves the functionality and usability of BrainPy. Core changes include
- support customization of low-level operators by using Numba
- fix bugs
What's Changed
- Provide custom operators written in numba for jax jit by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/122
- fix DOGDecay bugs; add more features by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/124
- fix bugs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/126
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.2...V2.1.3
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.2
- support rate-based whole-brain modeling
- add more neuron models, including rate neurons/synapses
- support Python 3.10
- improve delays etc. APIs
- and much more
What's Changed
- fix matplotlib dependency on "brainpy.analysis" module by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/110
- Sync master to brainpy-2.x branch by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/111
- add py3.6 test & delete multiple macos env by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/112
- Modify ci by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/113
- Add py3.10 test by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/115
- update python version by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/114
- add brainpylib mac py3.10 by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/116
- Enhance measure/input/brainpylib by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/117
- fix #105: Add customize connections docs by @ztqakita in https://github.com/PKU-NIP-Lab/BrainPy/pull/118
- fix bugs by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/119
- Whole brain modeling by @chaoming0625 in https://github.com/PKU-NIP-Lab/BrainPy/pull/121
Full Changelog: https://github.com/PKU-NIP-Lab/BrainPy/compare/V2.1.1...V2.1.2
- Python
Published by chaoming0625 about 4 years ago
brainpy - Version 2.1.1
This release continues to update the functionality of BrainPy. Core changes include
- numerical solvers for fractional differential equations
- more standard
brainpy.nninterfaces
New Features
- Numerical solvers for fractional differential equations
brainpy.fde.CaputoEulerbrainpy.fde.CaputoL1Schemabrainpy.fde.GLShortMemory
- Fractional neuron models
brainpy.dyn.FractionalFHRbrainpy.dyn.FractionalIzhikevich
- support
shared_kwargsinRNNTrainerandRNNRunner
- Python
Published by chaoming0625 about 4 years ago