Skip to content

Releases: brainpy/BrainPy

Version 2.2.0

29 Aug 10:25
55f8301

Choose a tag to compare

This release has provided important improvements for BrainPy, including usability, speed, functions, and others.

Backwards Incompatible changes

  1. brainpy.nn module is no longer supported and has been removed since version 2.2.0. Instead, users should use brainpy.train module for the training of BP algorithms, online learning, or offline learning algorithms, and brainpy.algorithms module for online / offline training algorithms.
  2. 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

  1. brainpy.dyn.xxx (neurons) and brainpy.dyn.xxx (synapse) are no longer supported. Please use brainpy.neurons, brainpy.synapses modules.
  2. brainpy.running.monitor has been removed.
  3. brainpy.nn module has been removed.

New features

  1. brainpy.math.Variable receives a batch_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.
  1. brainpy.train provides brainpy.train.BPTT for back-propagation algorithms, brainpy.train.Onlinetrainer for online training algorithms, brainpy.train.OfflineTrainer for offline training algorithms.
  2. brainpy.Base class supports _excluded_vars setting to ignore variables when retrieving variables by using Base.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'])
  1. brainpy.analysis.SlowPointFinder supports directly analyzing an instance of brainpy.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})
  1. brainpy.datasets supports MNIST, FashionMNIST, and other datasets.
  2. 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)
  1. brainpy.layers module provides commonly used models for DNN and reservoir computing.
  2. Support composable definition of synaptic models by using TwoEndConn, SynOut, SynSTP and SynLTP.
>>> 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())
  1. 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
  2. Provide shortcuts for GPU memory management via brainpy.math.disable_gpu_memory_preallocation(), and brainpy.math.clear_buffer_memory().

What's Changed

Full Changelog: V2.1.12...V2.2.0

Version 2.1.12

17 May 11:27
9e49bd1

Choose a tag to compare

Highlights

This release is excellent. We have made important improvements.

  1. 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
  2. make efficient checking on numerical values. Instead of direct id_tap() checking which has large overhead, currently brainpy.tools.check_erro_in_jit() is highly efficient.
  3. Fix JaxArray operator errors on None
  4. improve oo-to-function transformation speeds
  5. io works: .save_states() and .load_states()

What's Changed

Full Changelog: V2.1.11...V2.1.12

Version 2.1.11

15 May 06:13
231b566

Choose a tag to compare

What's Changed

Full Changelog: V2.1.10...V2.1.11

Version 2.1.9

05 May 05:26
8060516

Choose a tag to compare

What's Changed

Full Changelog: V2.1.8...V2.1.9

Version 2.1.10

06 May 03:39

Choose a tag to compare

  • Fix bugs on synapse delay

Full Changelog: V2.1.9...V2.1.10

Version 2.1.8

26 Apr 02:38
9202d30

Choose a tag to compare

What's Changed

Full Changelog: V2.1.7...V2.1.8

Version 2.1.7

22 Apr 08:01
6bf7cc0

Choose a tag to compare

What's Changed

Full Changelog: V2.1.5...V2.1.7

Version 2.1.5

18 Apr 14:21
efb7bb7

Choose a tag to compare

What's Changed

Full Changelog: V2.1.4...V2.1.5

Version 2.1.4

03 Apr 16:11
89f9b65

Choose a tag to compare

What's Changed

Full Changelog: V2.1.3...V2.1.4

Version 2.1.3

27 Mar 02:58
3d6b84f

Choose a tag to compare

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

Full Changelog: V2.1.2...V2.1.3