Skip to content

Commit 1d2c418

Browse files
authored
Merge branch 'brainpy:master' into master
2 parents fb5340c + a08ad48 commit 1d2c418

11 files changed

Lines changed: 22 additions & 78 deletions

File tree

.github/workflows/CI-models.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
python-version: [ "3.9", "3.10", "3.11"]
25+
python-version: [ "3.9", "3.10", "3.11", "3.12"]
2626

2727
steps:
2828
- uses: actions/checkout@v4
@@ -70,7 +70,7 @@ jobs:
7070
strategy:
7171
fail-fast: false
7272
matrix:
73-
python-version: [ "3.9", "3.10", "3.11"]
73+
python-version: [ "3.9", "3.10", "3.11", "3.12"]
7474

7575
steps:
7676
- uses: actions/checkout@v4
@@ -119,7 +119,7 @@ jobs:
119119
strategy:
120120
fail-fast: false
121121
matrix:
122-
python-version: ["3.9", "3.10", "3.11"]
122+
python-version: ["3.9", "3.10", "3.11", "3.12"]
123123

124124
steps:
125125
- uses: actions/checkout@v4
@@ -132,7 +132,7 @@ jobs:
132132
python -m pip install --upgrade pip
133133
python -m pip install numpy>=1.21.0
134134
python -m pip install -r requirements-dev.txt
135-
python -m pip install tqdm brainpylib
135+
python -m pip install tqdm
136136
pip uninstall brainpy -y
137137
python setup.py install
138138
- name: Test with pytest

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
python-version: [ "3.9", "3.10", "3.11" ]
31+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
3232

3333
steps:
3434
- name: Cancel Previous Runs
@@ -59,7 +59,7 @@ jobs:
5959
strategy:
6060
fail-fast: false
6161
matrix:
62-
python-version: [ "3.9", "3.10", "3.11" ]
62+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
6363

6464
steps:
6565
- name: Cancel Previous Runs
@@ -92,7 +92,7 @@ jobs:
9292
strategy:
9393
fail-fast: false
9494
matrix:
95-
python-version: [ "3.9", "3.10", "3.11" ]
95+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
9696

9797
steps:
9898
- name: Cancel Previous Runs

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@ BrainPy is a flexible, efficient, and extensible framework for computational neu
2222
- **Source on OpenI**: https://git.openi.org.cn/OpenI/BrainPy
2323

2424

25-
---
26-
**NOTE**
27-
28-
Starting from our experimental BrainPy package, a better and mature ecosystem for brain dynamics programming is emerging.
29-
Please see the [Brain Dynamics Programming Ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/) for more details.
30-
31-
32-
If you are heavily using BrainPy, please consider using [brainstate](https://brainstate.readthedocs.io) for a more stable, efficient, concise, and powerful experience.
33-
34-
35-
[brainstate](https://github.com/chaobrain/brainstate) is and will be active maintained and developed by our team. We highly recommend transferring your code to [brainstate](https://brainstate.readthedocs.io) for a better performance.
36-
37-
---
38-
39-
4025

4126
## Installation
4227

@@ -70,7 +55,6 @@ We provide a Binder environment for BrainPy. You can use the following button to
7055
## Ecosystem
7156

7257

73-
- **[Brain Dynamics Programming Ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/)**: An emerging and mature ecosystem for brain dynamics programming.
7458
- **[BrainPy](https://github.com/brainpy/BrainPy)**: The solution for the general-purpose brain dynamics programming.
7559
- **[brainpy-examples](https://github.com/brainpy/examples)**: Comprehensive examples of BrainPy computation.
7660
- **[brainpy-datasets](https://github.com/brainpy/datasets)**: Neuromorphic and Cognitive Datasets for Brain Dynamics Modeling.

brainpy/_src/dnn/linear.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from brainpy import math as bm
1313
from brainpy._src import connect, initialize as init
1414
from brainpy._src.context import share
15-
from brainpy._src.dependency_check import import_taichi, import_braintaichi
15+
from brainpy._src.dependency_check import import_taichi, import_braintaichi, raise_braintaichi_not_found
1616
from brainpy._src.dnn.base import Layer
1717
from brainpy._src.mixin import SupportOnline, SupportOffline, SupportSTDP
1818
from brainpy.check import is_initializer
@@ -241,7 +241,7 @@ def update(self, x):
241241
return x
242242

243243

244-
if ti is not None:
244+
if ti is not None and bti is not None:
245245

246246
# @numba.njit(nogil=True, fastmath=True, parallel=False)
247247
# def _cpu_dense_on_post(weight, spike, trace, w_min, w_max, out_w):
@@ -321,7 +321,7 @@ def _dense_on_pre(
321321

322322
def dense_on_pre(weight, spike, trace, w_min, w_max):
323323
if dense_on_pre_prim is None:
324-
raise PackageMissingError.by_purpose('taichi', 'custom operators')
324+
raise_braintaichi_not_found()
325325

326326
if w_min is None:
327327
w_min = -np.inf
@@ -341,7 +341,7 @@ def dense_on_pre(weight, spike, trace, w_min, w_max):
341341

342342
def dense_on_post(weight, spike, trace, w_min, w_max):
343343
if dense_on_post_prim is None:
344-
raise PackageMissingError.by_purpose('taichi', 'custom operators')
344+
raise_braintaichi_not_found()
345345

346346
if w_min is None:
347347
w_min = -np.inf
@@ -728,7 +728,7 @@ def _batch_csrmv(self, x):
728728
transpose=self.transpose)
729729

730730

731-
if ti is not None:
731+
if ti is not None and bti is not None:
732732
@ti.kernel
733733
def _csr_on_pre_update(
734734
old_w: ti.types.ndarray(ndim=1), # vector with shape of (num_syn)
@@ -852,7 +852,7 @@ def _csc_on_post_update(
852852

853853
def csr_on_pre_update(w, indices, indptr, spike, trace, w_min=None, w_max=None):
854854
if csr_on_pre_update_prim is None:
855-
raise PackageMissingError.by_purpose('taichi', 'customized operators')
855+
raise_braintaichi_not_found()
856856

857857
if w_min is None:
858858
w_min = -np.inf
@@ -874,7 +874,7 @@ def csr_on_pre_update(w, indices, indptr, spike, trace, w_min=None, w_max=None):
874874

875875
def coo_on_pre_update(w, pre_ids, post_ids, spike, trace, w_min=None, w_max=None):
876876
if coo_on_pre_update_prim is None:
877-
raise PackageMissingError.by_purpose('taichi', 'customized operators')
877+
raise_braintaichi_not_found()
878878

879879
if w_min is None:
880880
w_min = -np.inf
@@ -897,7 +897,7 @@ def coo_on_pre_update(w, pre_ids, post_ids, spike, trace, w_min=None, w_max=None
897897

898898
def csc_on_post_update(w, post_ids, indptr, w_ids, post_spike, pre_trace, w_min=None, w_max=None):
899899
if csc_on_post_update_prim is None:
900-
raise PackageMissingError.by_purpose('taichi', 'customized operators')
900+
raise_braintaichi_not_found()
901901

902902
if w_min is None:
903903
w_min = -np.inf

brainpy/_src/math/ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _check_tracer(self):
9898
self_value = self.value
9999
if hasattr(self_value, '_trace') and hasattr(self_value._trace.main, 'jaxpr_stack'):
100100
if len(self_value._trace.main.jaxpr_stack) == 0:
101-
raise RuntimeError('This Array is modified during the transformation. '
101+
raise jax.errors.UnexpectedTracerError('This Array is modified during the transformation. '
102102
'BrainPy only supports transformations for Variable. '
103103
'Please declare it as a Variable.') from jax.core.escaped_tracer_error(self_value, None)
104104
return self_value

brainpy/_src/math/tests/test_ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _f(self, b):
6262

6363
def test_tracing(self):
6464
print(self.f(1.))
65-
with self.assertRaises(RuntimeError):
65+
with self.assertRaises(jax.errors.UnexpectedTracerError):
6666
print(self.f(bm.ones(10)))
6767

6868

docker/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ jax
66
jaxlib
77
scipy>=1.1.0
88
brainpy
9-
brainpylib
109
brainpy_datasets
1110
h5py
1211
pathos
12+
braintaichi
1313

1414
# test requirements
1515
pytest

docs/index.rst

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ Installation
2020
# python 3.9-3.11
2121
pip install -U brainpy[cpu] # windows, linux, macos
2222
23-
.. tab-item:: GPU (CUDA 11.0)
24-
25-
.. code-block:: bash
26-
27-
pip install -U brainpy[cuda11] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
28-
29-
.. tab-item:: GPU (CUDA 12.0)
23+
.. tab-item:: GPU (CUDA 12)
3024

3125
.. code-block:: bash
3226
@@ -110,15 +104,6 @@ Learn more
110104
APIs may be changed over time. Please always keeps
111105
in mind what BrainPy version you are using.
112106

113-
.. note::
114-
Starting from our experimental BrainPy package, a better and mature ecosystem for brain dynamics programming is emerging.
115-
Please see the `Brain Dynamics Programming Ecosystem <https://ecosystem-for-brain-dynamics.readthedocs.io/>`_ for more details.
116-
117-
If you are heavily using BrainPy, please consider using `brainstate <https://brainstate.readthedocs.io>`_ for a more stable, efficient, concise, and powerful experience.
118-
119-
`brainstate <https://github.com/chaobrain/brainstate>`_ is and will be active maintained and developed by our team.
120-
We highly recommend transferring your code to brainstate for a better performance.
121-
122107

123108

124109
----

docs/quickstart/installation.rst

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ To install brainpy with minimum requirements (only depends on ``jax``), you can
3636
3737
# or
3838
39-
pip install brainpy[cuda11_mini] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 11.0
4039
pip install brainpy[cuda12_mini] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 12.0
4140
4241
# or
@@ -64,7 +63,6 @@ To install a GPU-only version of BrainPy, you can run
6463
.. code-block:: bash
6564
6665
pip install brainpy[cuda12] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 12.0
67-
pip install brainpy[cuda11] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 11.0
6866
6967
7068
@@ -79,25 +77,3 @@ you can run the following in your cloud TPU VM:
7977
pip install brainpy[tpu] -f https://storage.googleapis.com/jax-releases/libtpu_releases.html # for google TPU
8078
8179
82-
83-
``brainpylib``
84-
--------------
85-
86-
87-
``brainpylib`` defines a set of useful operators for building and simulating spiking neural networks.
88-
89-
90-
To install the ``brainpylib`` package on CPU devices, you can run
91-
92-
.. code-block:: bash
93-
94-
pip install brainpylib
95-
96-
97-
To install the ``brainpylib`` package on CUDA (Linux only), you can run
98-
99-
100-
.. code-block:: bash
101-
102-
pip install brainpylib
103-

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ braintaichi
99
numba
1010
brainstate
1111
braintools
12+
setuptools
1213

1314

1415
# test requirements

0 commit comments

Comments
 (0)