Brainpy

Latest version: v2.6.0

Safety actively analyzes 624811 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 11

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.section_input([0., 1., 0.5], [200, 200, 200], return_length=True)
runner.run(duration, dyn_args=dict(Iext=Iext))
bp.visualize.line_plot(runner.mon.ts, runner.mon['V'], legend='V')

run 2
Iext, duration = bp.inputs.section_input([0.5], [200], return_length=True)
runner.run(duration, dyn_args=dict(Iext=Iext))
bp.visualize.line_plot(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(..., fun_after_report=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.LatencyEncoder`
- `brainpy.encoding.PoissonEncoder`
- `brainpy.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, fun_inputs=f_input, inputs=('I.input', 10.))


python
new version

def f_input(tdi):
net.E.input += 10.
net.I.input += 10.
runner = bp.DSRunner(net, inputs=f_input)




``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
dyn_args={'I': bp.inputs.ramp_input(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.},
dyn_args={'I': bp.inputs.ramp_input(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.Mode``
- ``brainpy.modes.NormalMode `` => ``brainpy.math.NonBatchingMode``
- ``brainpy.modes.BatchingMode `` => ``brainpy.math.BatchingMode``
- ``brainpy.modes.TrainingMode `` => ``brainpy.math.TrainingMode``
- ``brainpy.modes.normal `` => ``brainpy.math.nonbatching_mode``
- ``brainpy.modes.batching `` => ``brainpy.math.batching_mode``
- ``brainpy.modes.training `` => ``brainpy.math.training_mode``

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

1. Add synapse projection with Delta synapse models through ``brainpy.dyn.HalfProjDelta`` and ``brainpy.dyn.FullProjDelta``.
2. 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.
3. Add ``brainpy.reset_level()`` decorator so that the state resetting order can be customized by users.
4. Add ``brainpy.math.ein_rearrange``, ``brainpy.math.ein_reduce``, and ``brainpy.math.ein_repeat`` functions
5. Add ``brainpy.math.scan`` transformation.
6. 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.
7. Many bug fixes.
8. A new version of ``brainpylib>=0.2.4`` has 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/tutorial_advanced/operator_custom_with_taichi.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.ipynb` of 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.defjvp`` and ``brainpy.math.XLACustomOp.defjvp`` by 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.ifelse`` bugs 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_grad` and `brainpy.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_normal` by 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.softplus` and `brainpy.dnn.SoftPlus` by chaoming0625 in https://github.com/brainpy/BrainPy/pull/581
* add `TruncatedNormal` to `initialize.py` by charlielam0615 in https://github.com/brainpy/BrainPy/pull/583
* Fix `_format_shape` in `random_inits.py` by charlielam0615 in https://github.com/brainpy/BrainPy/pull/584
* fix bugs in `truncated_normal` by 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.unflatten` and `brainpy.dnn.Unflatten` by chaoming0625 in https://github.com/brainpy/BrainPy/pull/588
* [math] add ``ein_rearrange``, ``ein_reduce``, and ``ein_repeat`` functions 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_input` in the `step_run` function. 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.scan` by chaoming0625 in https://github.com/brainpy/BrainPy/pull/604
* ``disable_ jit`` support in ``brainpy.math.scan`` by 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

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.surrogate_grad(1., membrane_potential)

surrogate forward function
surro_spk = fun.surrogate_fun(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 reset_state(self, batch_or_mode=None): define variables
self.a = bp.init.variable_(bm.zeros, (self.num,), batch_or_mode)

def load_state(self, state_dict): load states from an external dict
self.a.value = bm.as_jax(state_dict['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, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=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](https://github.com/taichi-dev/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 numba_cpu_fun(a, b, out_a, out_b):
out_a[:] = a
out_b[:] = b


ti.kernel
def taichi_gpu_fun(a, b, out_a, out_b):
for i in range(a.size):
out_a[i] = a[i]
for i in range(b.size):
out_b[i] = b[i]


prim = bm.XLACustomOp(cpu_kernel=numba_cpu_fun, gpu_kernel=taichi_gpu_fun)
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/test_STDP.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.16` by 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 libtaichi_c_api.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 `taichi` by 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()` and `brainpy.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`, and `clear_input` helpers 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

2.4.5

New Features

- A new version of ``brainpylib==0.1.10`` has 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.math`` have been refined.
- ``.tracing_variable()`` has been created to support tracing ``Variable``s 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.AllToAll`` module
- RandomState.
- ``brainpy.math.cond`` and ``brainpy.math.while_loop`` when 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.10`` by chaoming0625 in https://github.com/brainpy/BrainPy/pull/468
* Support tracing ``Variable`` during computation and compilation by using ``tracing_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 model` with 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.SupportOnline`` and `brainpy.mixin.SupportOffline` by 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.dyn` module & 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 `cond` and `while_loop` when 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.bio_models and abstract_models by AkitsuFaye in https://github.com/brainpy/BrainPy/pull/500
* [reset] update logics of state reset in `DynamicalSystem` by 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.dyn` module 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

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.ReceiveInputProj`` by 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.14` by 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 `FixedTotalNum` class 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.Alpha` synapse 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

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 ``DynamicalSystem`` interface

New Features

1. 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



2. New style ``.update()`` function in ``brainpy.DynamicalSystem`` which resolves all compatible issues. Starting from this version, all ``update()`` no longer needs to receive a global shared argument such as ``tdi``.

python

class YourDynSys(bp.DynamicalSystem):
def update(self, x):
t = bp.share['t']
dt = bp.share['dt']
i = bp.share['i']
...



3. Optimize the connection-building process when using ``brainpy.conn.ScaleFreeBA``, ``brainpy.conn.ScaleFreeBADual``, ``brainpy.conn.PowerLaw``

4. New dual exponential model ``brainpy.dyn.DualExponV2`` can be aligned with post dimension.

5. More synaptic projection abstractions, including
- ``brainpy.dyn.VanillaProj``
- ``brainpy.dyn.ProjAlignPostMg1``
- ``brainpy.dyn.ProjAlignPostMg2``
- ``brainpy.dyn.ProjAlignPost1``
- ``brainpy.dyn.ProjAlignPost2``
- ``brainpy.dyn.ProjAlignPreMg1``
- ``brainpy.dyn.ProjAlignPreMg2``

5. 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`'s `require` function 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 ``lif`` model bugs and support two kinds of spike reset: ``soft`` and ``hard`` by 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

Page 1 of 11

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.