Skip to content

Latest commit

 

History

History
1083 lines (770 loc) · 43.9 KB

changelog.rst

File metadata and controls

1083 lines (770 loc) · 43.9 KB

Release notes (brainpy)

Note

All history release notes please see GitHub releases.

brainpy 2.2.x

BrainPy 2.2.x is a complete re-design of the framework, tackling the shortcomings of brainpy 2.1.x generation, effectively bringing it to research needs and standards.

Version 2.2.1 (2022.09.09)

This release fixes bugs found in the codebase and improves the usability and functions of BrainPy.

Bug fixes

  1. Fix the bug of operator customization in brainpy.math.XLACustomOp and brainpy.math.register_op. Now, it supports operator customization by using NumPy and Numba interface. For instance,
import brainpy.math as bm

def abs_eval(events, indices, indptr, post_val, values):
      return post_val

def con_compute(outs, ins):
      post_val = 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]
            old_value = post_val[index]
            post_val[index] = values + old_value

event_sum = bm.XLACustomOp(eval_shape=abs_eval, con_compute=con_compute)
  1. Fix the bug of brainpy.tools.DotDict. Now, it is compatible with the transformations of JAX. For instance,
import brainpy as bp
from jax import vmap

@vmap
def multiple_run(I):
  hh = bp.neurons.HH(1)
  runner = bp.dyn.DSRunner(hh, inputs=('input', I), numpy_mon_after_run=False)
  runner.run(100.)
  return runner.mon

mon = multiple_run(bp.math.arange(2, 10, 2))

New features

  1. Add numpy operators brainpy.math.mat, brainpy.math.matrix, brainpy.math.asmatrix.
  2. Improve translation rules of brainpylib operators, improve its running speeds.
  3. Support DSView of DynamicalSystem instance. Now, it supports defining models with a slice view of a DS instance. For example,
import brainpy as bp
import brainpy.math as bm


class EINet_V2(bp.dyn.Network):
  def __init__(self, scale=1.0, method='exp_auto'):
    super(EINet_V2, 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 = EINet_V2(scale=1., method='exp_auto')
# 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)

Version 2.2.0 (2022.08.12)

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

brainpy 2.1.x

Version 2.1.12 (2022.05.17)

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 (2022.05.15)

What's Changed

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

Version 2.1.10 (2022.05.05)

What's Changed

Full Changelog: V2.1.8...V2.1.10

Version 2.1.8 (2022.04.26)

What's Changed

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

Version 2.1.7 (2022.04.22)

What's Changed

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

Version 2.1.5 (2022.04.18)

What's Changed

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

Version 2.1.4 (2022.04.04)

What's Changed

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

Version 2.1.3 (2022.03.27)

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

Version 2.1.2 (2022.03.23)

This release improves the functionality and usability of BrainPy. Core changes include

  • support rate-based whole-brain modeling
  • add more neuron models, including rate neurons/synapses
  • support Python 3.10
  • improve delays etc. APIs

What's Changed

Full Changelog: V2.1.1...V2.1.2

Version 2.1.1 (2022.03.18)

This release continues to update the functionality of BrainPy. Core changes include

  • numerical solvers for fractional differential equations
  • more standard brainpy.nn interfaces

New Features

  • Numerical solvers for fractional differential equations
    • brainpy.fde.CaputoEuler
    • brainpy.fde.CaputoL1Schema
    • brainpy.fde.GLShortMemory
  • Fractional neuron models
    • brainpy.dyn.FractionalFHR
    • brainpy.dyn.FractionalIzhikevich
  • support shared_kwargs in RNNTrainer and RNNRunner

Version 2.1.0 (2022.03.14)

Highlights

We are excited to announce the release of BrainPy 2.1.0. This release is composed of nearly 270 commits since 2.0.2, made by Chaoming Wang, Xiaoyu Chen, and Tianqiu Zhang .

BrainPy 2.1.0 updates are focused on improving usability, functionality, and stability of BrainPy. Highlights of version 2.1.0 include:

  • New module brainpy.dyn for dynamics building and simulation. It is composed of many neuron models, synapse models, and others.
  • New module brainpy.nn for neural network building and training. It supports to define reservoir models, artificial neural networks, ridge regression training, and back-propagation through time training.
  • New module brainpy.datasets for convenient dataset construction and initialization.
  • New module brainpy.integrators.dde for numerical integration of delay differential equations.
  • Add more numpy-like operators in brainpy.math module.
  • Add automatic continuous integration on Linux, Windows, and MacOS platforms.
  • Fully update brainpy documentation.
  • Fix bugs on brainpy.analysis and brainpy.math.autograd

Incompatible changes

  • Remove brainpy.math.numpy module.
  • Remove numba requirements
  • Remove matplotlib requirements
  • Remove steps in brainpy.dyn.DynamicalSystem
  • Remove travis CI

New Features

  • brainpy.ddeint for numerical integration of delay differential equations, the supported methods include:

    • Euler
    • MidPoint
    • Heun2
    • Ralston2
    • RK2
    • RK3
    • Heun3
    • Ralston3
    • SSPRK3
    • RK4
    • Ralston4
    • RK4Rule38
  • set default int/float/complex types
    • brainpy.math.set_dfloat()
    • brainpy.math.set_dint()
    • brainpy.math.set_dcomplex()
  • Delay variables
    • brainpy.math.FixedLenDelay
    • brainpy.math.NeutralDelay
  • Dedicated operators
    • brainpy.math.sparse_matmul()
  • More numpy-like operators

  • Neural network building brainpy.nn

  • Dynamics model building and simulation brainpy.dyn

Version 2.0.2 (2022.02.11)

There are important updates by Chaoming Wang in BrainPy 2.0.2.

  • provide pre2post_event_prod operator
  • support array creation from a list/tuple of JaxArray in brainpy.math.asarray and brainpy.math.array
  • update brainpy.ConstantDelay, add .latest and .oldest attributes
  • add brainpy.IntegratorRunner support for efficient simulation of brainpy integrators
  • support auto finding of RandomState when JIT SDE integrators
  • fix bugs in SDE exponential_euler method
  • move parallel running APIs into brainpy.simulation
  • add brainpy.math.syn2post_mean, brainpy.math.syn2post_softmax, brainpy.math.pre2post_mean and brainpy.math.pre2post_softmax operators

Version 2.0.1 (2022.01.31)

Today we release BrainPy 2.0.1. This release is composed of over 70 commits since 2.0.0, made by Chaoming Wang, Xiaoyu Chen, and Tianqiu Zhang .

BrainPy 2.0.0 updates are focused on improving documentation and operators. Core changes include:

  • Improve brainpylib operators
  • Complete documentation for programming system
  • Add more numpy APIs
  • Add jaxfwd in autograd module
  • And other changes

Version 2.0.0.1 (2022.01.05)

  • Add progress bar in brainpy.StructRunner

Version 2.0.0 (2021.12.31)

Start a new version of BrainPy.

Highlight

We are excited to announce the release of BrainPy 2.0.0. This release is composed of over 260 commits since 1.1.7, made by Chaoming Wang, Xiaoyu Chen, and Tianqiu Zhang .

BrainPy 2.0.0 updates are focused on improving performance, usability and consistence of BrainPy. All the computations are migrated into JAX. Model building, simulation, training and analysis are all based on JAX. Highlights of version 2.0.0 include:

  • brainpylib are provided to dedicated operators for brain dynamics programming
  • Connection APIs in brainpy.conn module are more efficient.
  • Update analysis tools for low-dimensional and high-dimensional systems in brainpy.analysis module.
  • Support more general Exponential Euler methods based on automatic differentiation.
  • Improve the usability and consistence of brainpy.math module.
  • Remove JIT compilation based on Numba.
  • Separate brain building with brain simulation.

Incompatible changes

  • remove brainpy.math.use_backend()
  • remove brainpy.math.numpy module
  • no longer support .run() in brainpy.DynamicalSystem (see New Features)
  • remove brainpy.analysis.PhasePlane (see New Features)
  • remove brainpy.analysis.Bifurcation (see New Features)
  • remove brainpy.analysis.FastSlowBifurcation (see New Features)

New Features

  • Exponential Euler method based on automatic differentiation
    • brainpy.ode.ExpEulerAuto
  • Numerical optimization based low-dimensional analyzers:
    • brainpy.analysis.PhasePlane1D
    • brainpy.analysis.PhasePlane2D
    • brainpy.analysis.Bifurcation1D
    • brainpy.analysis.Bifurcation2D
    • brainpy.analysis.FastSlow1D
    • brainpy.analysis.FastSlow2D
  • Numerical optimization based high-dimensional analyzer:
    • brainpy.analysis.SlowPointFinder
  • Dedicated operators in brainpy.math module:
    • brainpy.math.pre2post_event_sum
    • brainpy.math.pre2post_sum
    • brainpy.math.pre2post_prod
    • brainpy.math.pre2post_max
    • brainpy.math.pre2post_min
    • brainpy.math.pre2syn
    • brainpy.math.syn2post
    • brainpy.math.syn2post_prod
    • brainpy.math.syn2post_max
    • brainpy.math.syn2post_min
  • Conversion APIs in brainpy.math module:
    • brainpy.math.as_device_array()
    • brainpy.math.as_variable()
    • brainpy.math.as_jaxarray()
  • New autograd APIs in brainpy.math module:
    • brainpy.math.vector_grad()
  • Simulation runners:
    • brainpy.ReportRunner
    • brainpy.StructRunner
    • brainpy.NumpyRunner
  • Commonly used models in brainpy.models module
    • brainpy.models.LIF
    • brainpy.models.Izhikevich
    • brainpy.models.AdExIF
    • brainpy.models.SpikeTimeInput
    • brainpy.models.PoissonInput
    • brainpy.models.DeltaSynapse
    • brainpy.models.ExpCUBA
    • brainpy.models.ExpCOBA
    • brainpy.models.AMPA
    • brainpy.models.GABAa
  • Naming cache clean: brainpy.clear_name_cache
  • add safe in-place operations of update() method and .value assignment for JaxArray

Documentation

  • Complete tutorials for quickstart
  • Complete tutorials for dynamics building
  • Complete tutorials for dynamics simulation
  • Complete tutorials for dynamics training
  • Complete tutorials for dynamics analysis
  • Complete tutorials for API documentation

brainpy 1.1.x

If you are using brainpy==1.x, you can find documentation, examples, and models through the following links:

Version 1.1.7 (2021.12.13)

  • fix bugs on numpy_array() conversion in brainpy.math.utils module

Version 1.1.5 (2021.11.17)

API changes:

  • fix bugs on ndarray import in brainpy.base.function.py
  • convenient 'get_param' interface brainpy.simulation.layers
  • add more weight initialization methods

Doc changes:

  • add more examples in README

Version 1.1.4

API changes:

  • add .struct_run() in DynamicalSystem
  • add numpy_array() conversion in brainpy.math.utils module
  • add Adagrad, Adadelta, RMSProp optimizers
  • remove setting methods in brainpy.math.jax module
  • remove import jax in brainpy.__init__.py and enable jax setting, including
    • enable_x64()
    • set_platform()
    • set_host_device_count()
  • enable b=None as no bias in brainpy.simulation.layers
  • set int_ and float_ as default 32 bits
  • remove dtype setting in Initializer constructor

Doc changes:

  • add optimizer in "Math Foundation"
  • add dynamics training docs
  • improve others

Version 1.1.3

  • fix bugs of JAX parallel API imports
  • fix bugs of post_slice structure construction
  • update docs

Version 1.1.2

  • add pre2syn and syn2post operators
  • add verbose and check option to Base.load_states()
  • fix bugs on JIT DynamicalSystem (numpy backend)

Version 1.1.1

  • fix bugs on symbolic analysis: model trajectory
  • change absolute access in the variable saving and loading to the relative access
  • add UnexpectedTracerError hints in JAX transformation functions

Version 1.1.0 (2021.11.08)

This package releases a new version of BrainPy.

Highlights of core changes:

math module

  • support numpy backend
  • support JAX backend
  • support jit, vmap and pmap on class objects on JAX backend
  • support grad, jacobian, hessian on class objects on JAX backend
  • support make_loop, make_while, and make_cond on JAX backend
  • support jit (based on numba) on class objects on numpy backend
  • unified numpy-like ndarray operation APIs
  • numpy-like random sampling APIs
  • FFT functions
  • gradient descent optimizers
  • activation functions
  • loss function
  • backend settings

base module

  • Base for whole Version ecosystem
  • Function to wrap functions
  • Collector and TensorCollector to collect variables, integrators, nodes and others

integrators module

  • class integrators for ODE numerical methods
  • class integrators for SDE numerical methods

simulation module

  • support modular and composable programming
  • support multi-scale modeling
  • support large-scale modeling
  • support simulation on GPUs
  • fix bugs on firing_rate()
  • remove _i in update() function, replace _i with _dt, meaning the dynamic system has the canonic equation form of dx/dt = f(x, t, dt)
  • reimplement the input_step and monitor_step in a more intuitive way
  • support to set dt in the single object level (i.e., single instance of DynamicSystem)
  • common used DNN layers
  • weight initializations
  • refine synaptic connections

brainpy 1.0.x

Version 1.0.3 (2021.08.18)

Fix bugs on

  • firing rate measurement
  • stability analysis

Version 1.0.2

This release continues to improve the user-friendliness.

Highlights of core changes:

  • Remove support for Numba-CUDA backend
  • Super initialization super(XXX, self).__init__() can be done at anywhere (not required to add at the bottom of the __init__() function).
  • Add the output message of the step function running error.
  • More powerful support for Monitoring
  • More powerful support for running order scheduling
  • Remove unsqueeze() and squeeze() operations in brainpy.ops
  • Add reshape() operation in brainpy.ops
  • Improve docs for numerical solvers
  • Improve tests for numerical solvers
  • Add keywords checking in ODE numerical solvers
  • Add more unified operations in brainpy.ops
  • Support "@every" in steps and monitor functions
  • Fix ODE solver bugs for class bounded function
  • Add build phase in Monitor

Version 1.0.1

  • Fix bugs

Version 1.0.0

  • NEW VERSION OF BRAINPY
  • Change the coding style into the object-oriented programming
  • Systematically improve the documentation

brainpy 0.x

Version 0.3.5

  • Add 'timeout' in sympy solver in neuron dynamics analysis
  • Reconstruct and generalize phase plane analysis
  • Generalize the repeat mode of Network to different running duration between two runs
  • Update benchmarks
  • Update detailed documentation

Version 0.3.1

  • Add a more flexible way for NeuState/SynState initialization
  • Fix bugs of "is_multi_return"
  • Add "hand_overs", "requires" and "satisfies".
  • Update documentation
  • Auto-transform range to numba.prange
  • Support _obj_i, _pre_i, _post_i for more flexible operation in scalar-based models

Version 0.3.0

Computation API

  • Rename "brainpy.numpy" to "brainpy.backend"
  • Delete "pytorch", "tensorflow" backends
  • Add "numba" requirement
  • Add GPU support

Profile setting

  • Delete "backend" profile setting, add "jit"

Core systems

  • Delete "autopepe8" requirement
  • Delete the format code prefix
  • Change keywords "_t_, _dt_, _i_" to "_t, _dt, _i"
  • Change the "ST" declaration out of "requires"
  • Add "repeat" mode run in Network
  • Change "vector-based" to "mode" in NeuType and SynType definition

Package installation

  • Remove "pypi" installation, installation now only rely on "conda"

Version 0.2.4

API changes

  • Fix bugs

Version 0.2.3

API changes

  • Add "animate_1D" in visualization module
  • Add "PoissonInput", "SpikeTimeInput" and "FreqInput" in inputs module
  • Update phase_portrait_analyzer.py

Models and examples

  • Add CANN examples

Version 0.2.2

API changes

  • Redesign visualization
  • Redesign connectivity
  • Update docs

Version 0.2.1

API changes

  • Fix bugs in numba import
  • Fix bugs in numpy mode with scalar model

Version 0.2.0

API changes

  • For computation: numpy, numba
  • For model definition: NeuType, SynConn
  • For model running: Network, NeuGroup, SynConn, Runner
  • For numerical integration: integrate, Integrator, DiffEquation
  • For connectivity: One2One, All2All, GridFour, grid_four, GridEight, grid_eight, GridN, FixedPostNum, FixedPreNum, FixedProb, GaussianProb, GaussianWeight, DOG
  • For visualization: plot_value, plot_potential, plot_raster, animation_potential
  • For measurement: cross_correlation, voltage_fluctuation, raster_plot, firing_rate
  • For inputs: constant_current, spike_current, ramp_current.

Models and examples

  • Neuron models: HH model, LIF model, Izhikevich model
  • Synapse models: AMPA, GABA, NMDA, STP, GapJunction
  • Network models: gamma oscillation