Skip to content

Commit 534e043

Browse files
committed
update docs and apis
1 parent 30ae2c2 commit 534e043

17 files changed

+3284
-3659
lines changed

.github/workflows/Linux_CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
python -m pip install flake8 pytest
31-
python -m pip install https://github.com/google/jax/archive/refs/tags/jax-v0.3.14.tar.gz
31+
# python -m pip install https://github.com/google/jax/archive/refs/tags/jax-v0.3.14.tar.gz
3232
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
3333
python setup.py install
3434
- name: Lint with flake8

.github/workflows/MacOS_CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
python -m pip install flake8 pytest
31-
python -m pip install https://github.com/google/jax/archive/refs/tags/jax-v0.3.14.tar.gz
31+
# python -m pip install https://github.com/google/jax/archive/refs/tags/jax-v0.3.14.tar.gz
3232
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
3333
python setup.py install
3434
- name: Lint with flake8

brainpy/dyn/layers/linear.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def __init__(
7575
self.W = bm.TrainVar(self.W)
7676
self.b = None if (self.b is None) else bm.TrainVar(self.b)
7777

78+
def __repr__(self):
79+
return (f'{self.__class__.__name__}(name={self.name}, '
80+
f'num_in={self.num_in}, '
81+
f'num_out={self.num_out}, '
82+
f'mode={self.mode})')
83+
7884
def reset_state(self, batch_size=None):
7985
pass
8086

@@ -173,7 +179,7 @@ def offline_fit(self,
173179
xs = bm.concatenate([bm.ones(xs.shape[:2] + (1,)), xs], axis=-1) # (..., 1 + num_ff_input)
174180

175181
# solve weights by offline training methods
176-
weights = self.offline_fit_by(target, xs, ys)
182+
weights = self.offline_fit_by(self.name, target, xs, ys)
177183

178184
# assign trained weights
179185
if self.b is None:

brainpy/math/jaxarray.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ def update(self, value):
7676
"""
7777
if self._outside_global_jit and _global_jit_mode:
7878
raise MathError(msg)
79+
if isinstance(value, JaxArray):
80+
value = value.value
81+
elif isinstance(value, np.ndarray):
82+
value = jnp.asarray(value)
83+
elif isinstance(value, jnp.ndarray):
84+
pass
85+
else:
86+
value = jnp.asarray(value)
87+
# check
7988
if value.shape != self._value.shape:
8089
raise MathError(f"The shape of the original data is {self._value.shape}, "
8190
f"while we got {value.shape}.")

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ high-performance Brain Dynamics Programming (BDP). Among its key ingredients, Br
1010
delay differential equations (DDEs),
1111
fractional differential equations (FDEs), etc.
1212
- **Dynamics building** with the modular and composable programming interface.
13-
- **Dynamics simulation** tools for various brain objects.
14-
- **Dynamics training** tools with various machine learning algorithms,
13+
- **Dynamics simulation** for various brain objects with parallel supports.
14+
- **Dynamics training** with various machine learning algorithms,
1515
like FORCE learning, ridge regression, back-propagation, etc.
16-
- **Dynamics analysis** tools for differential equations, including
16+
- **Dynamics analysis** for low- and high-dimensional systems, including
1717
phase plane analysis, bifurcation analysis, linearization analysis,
1818
and fixed/slow point finding.
1919
- And more others ......

docs/tutorial_math/tutorial_for_jax_ops.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/tutorial_training/bp_training.ipynb

Lines changed: 789 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)