Version 2.2.0
This release has provided important improvements for BrainPy, including usability, speed, functions, and others.
Backwards Incompatible changes
brainpy.nn
module is no longer supported and has been removed since version 2.2.0. Instead, users should usebrainpy.train
module for the training of BP algorithms, online learning, or offline learning algorithms, andbrainpy.algorithms
module for online / offline training algorithms.- The
update()
function for the model definition has been changed:
>>> # 2.1.x
>>>
>>> import brainpy as bp
>>>
>>> class SomeModel(bp.dyn.DynamicalSystem):
>>> def __init__(self, ):
>>> ......
>>> def update(self, t, dt):
>>> pass
>>> # 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.synapses
modules.brainpy.running.monitor
has been removed.brainpy.nn
module has been removed.
New features
brainpy.math.Variable
receives abatch_axis
setting to represent the batch axis of the data.
>>> import brainpy.math as bm
>>> a = bm.Variable(bm.zeros((1, 4, 5)), batch_axis=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 batch_axis=0.
brainpy.train
providesbrainpy.train.BPTT
for back-propagation algorithms,brainpy.train.Onlinetrainer
for online training algorithms,brainpy.train.OfflineTrainer
for offline training algorithms.brainpy.Base
class supports_excluded_vars
setting to ignore variables when retrieving variables by usingBase.vars()
method.
>>> class OurModel(bp.Base):
>>> _excluded_vars = ('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.SlowPointFinder
supports directly analyzing an instance ofbrainpy.dyn.DynamicalSystem
.
>>> hh = bp.neurons.HH(1)
>>> finder = bp.analysis.SlowPointFinder(hh, target_vars={'V': hh.V, 'm': hh.m, 'h': hh.h, 'n': hh.n})
brainpy.datasets
supports MNIST, FashionMNIST, and other datasets.- Supports defining conductance-based neuron models``.
>>> 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)
brainpy.layers
module provides commonly used models for DNN and reservoir computing.- Support composable definition of synaptic models by using
TwoEndConn
,SynOut
,SynSTP
andSynLTP
.
>>> bp.synapses.Exponential(self.E, self.E, bp.conn.FixedProb(prob),
>>> g_max=0.03 / scale, tau=5,
>>> output=bp.synouts.COBA(E=0.),
>>> stp=bp.synplast.STD())
- Provide commonly used surrogate gradient function for spiking generation, including
brainpy.math.spike_with_sigmoid_grad
brainpy.math.spike_with_linear_grad
brainpy.math.spike_with_gaussian_grad
brainpy.math.spike_with_mg_grad
- Provide shortcuts for GPU memory management via
brainpy.math.disable_gpu_memory_preallocation()
, andbrainpy.math.clear_buffer_memory()
.
What's Changed
- fix #207: synapses update first, then neurons, finally delay variables by @chaoming0625 in #219
- docs: add logos by @ztqakita in #218
- Add the biological NMDA model by @c-xy17 in #221
- docs: fix mathjax problem by @ztqakita in #222
- Add the parameter R to the LIF model by @c-xy17 in #224
- new version of brainpy: V2.2.0-rc1 by @chaoming0625 in #226
- update training apis by @chaoming0625 in #227
- Update quickstart and the analysis module by @c-xy17 in #229
- Eseential updates for montors, analysis, losses, and examples by @chaoming0625 in #230
- add numpy op tests by @ztqakita in #231
- Integrated simulation, simulaton and analysis by @chaoming0625 in #232
- update docs by @chaoming0625 in #233
- unify
brainpy.layers
with other modules inbrainpy.dyn
by @chaoming0625 in #234 - fix bugs by @chaoming0625 in #235
- update apis, docs, examples and others by @chaoming0625 in #236
- fixes by @chaoming0625 in #237
- fix: add dtype promotion = standard by @ztqakita in #239
- updates by @chaoming0625 in #240
- update training docs by @chaoming0625 in #241
- change doc path/organization by @chaoming0625 in #242
- Update advanced docs by @chaoming0625 in #243
- update quickstart docs & enable jit error checking by @chaoming0625 in #244
- update apis and examples by @chaoming0625 in #245
- update apis and tests by @chaoming0625 in #246
- Docs update and bugs fixed by @ztqakita in #247
- version 2.2.0 by @chaoming0625 in #248
- add norm and pooling & fix bugs in operators by @ztqakita in #249
Full Changelog: V2.1.12...V2.2.0