Leveraging Taichi Lang to Customize Brain Dynamics Operators
braintaichi leverages Taichi Lang to customize brain dynamics operators.
Quick Start
import taichi as ti
import braintaichi as bti
# define the custom kernel
@ti.kernel
def transpose_bool_homo_kernel(
values: ti.types.ndarray(ndim=1),
indices: ti.types.ndarray(ndim=1),
indptr: ti.types.ndarray(ndim=1),
events: ti.types.ndarray(ndim=1),
out: ti.types.ndarray(ndim=1)
):
value = values[0]
ti.loop_config(serialize=True)
for row_i in range(indptr.shape[0] - 1):
if events[row_i]:
for j in range(indptr[row_i], indptr[row_i + 1]):
out[indices[j]] += value
kernel = bti.XLACustomOp(
cpu_kernel=transpose_bool_homo_kernel,
gpu_kernel=transpose_bool_homo_kernel,
)
# run with the sample data
import numpy as np
import jax
import jax.numpy as jnp
from scipy.sparse import csr_matrix
csr = csr_matrix((np.random.rand(10, 10) < 0.5).astype(float))
events = np.random.rand(10) < 0.5
out = kernel(
jnp.array(csr.data),
jnp.array(csr.indices),
jnp.array(csr.indptr),
events,
outs=[jax.ShapeDtypeStruct([10], dtype=jnp.float32)]
)
print(out)
Installation
You can install braintaichi via pip:
pip install braintaichi --upgrade
Documentation
The official documentation is hosted on Read the Docs: https://braintaichi.readthedocs.io
See also the BDP ecosystem
We are building the brain dynamics programming ecosystem: https://ecosystem-for-brain-dynamics.readthedocs.io/
Citation
If you think braintaichi is significant in your work, please consider to cite the following pubilication:
@inproceedings{wang2024brainpy,
title={A differentiable brain simulator bridging brain simulation and brain-inspired computing},
author={Wang, Chaoming and Zhang, Tianqiu and He, Sichao and Gu, Hongyaoxing and Li, Shangyang and Wu, Si},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024}
}
Metadata
Release files for braintaichi 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 169.5 MB
Release files / braintaichi-0.0.5-cp312-cp312-win_amd64.whl
| Download URL | braintaichi-0.0.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 373.6 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c3fdc330edb27cd00bdc3b313ed2f3f368ffdcfa1b7ca9439f741b54111dbbba
|
|
BLAKE2b-256 checksum How to use checksums |
73085b70dc4ab6fbd636a6ac3efa7b0987eb3e6159c17c7956d1d59e5d5f4b7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | braintaichi-0.0.5-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 41.9 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
00b9a5392052939ed21f16f605331b07bf4a28a9efbc601212df80365ec1da07
|
|
BLAKE2b-256 checksum How to use checksums |
30b192555e20a92394b03b328f6e8e139a2c9f32cb9c0589f668708bbe87a6ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | braintaichi-0.0.5-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 14.2 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
692a99af729355f0d49a904761366451c555972cf0a7d6a13338cf5856f434bd
|
|
BLAKE2b-256 checksum How to use checksums |
39a2254f634f564fdad14ac03de9a3852d7f13d5d3fa5217cb6b76eed852032d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp311-cp311-win_amd64.whl
| Download URL | braintaichi-0.0.5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 373.2 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
45763bd1036738af976bafcdfc0c8dc171966382d50df0ea01d129a764f66d47
|
|
BLAKE2b-256 checksum How to use checksums |
e4b2b14ce67748913536cee049a2d557ee611c2f52949b0646a47427460fe456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | braintaichi-0.0.5-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 41.9 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1f707eeb1abf4c395c71413b6d37f9b72d1902840d7bf5c196cf7eee3d0adfa7
|
|
BLAKE2b-256 checksum How to use checksums |
d80a325e9b9ec8d67d01aed74a8f31b83afab2809c5274bacb1ff9119ba0d888
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | braintaichi-0.0.5-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 14.2 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
824833a3cb850de9c54d967b87ca0fe8a48a02eb3cb9002a34275e39e0a47bb2
|
|
BLAKE2b-256 checksum How to use checksums |
ed9c21e333fba6faf28a7aa6d438f1af35be443b539d48fb639fe06e3a04274b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp310-cp310-win_amd64.whl
| Download URL | braintaichi-0.0.5-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 371.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1877ffc720afcbf62a9e5c3711edd49f43efe673349659f123a16767c253b0d5
|
|
BLAKE2b-256 checksum How to use checksums |
7ac29e1401ba7dfc86327a8f830d0cdb43108a835c671c9107e74eb88708ec6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | braintaichi-0.0.5-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 41.9 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
28dd349effa2f75192c743a6fde10eec32afebf94579ef5a05a3d3f79f768d68
|
|
BLAKE2b-256 checksum How to use checksums |
0bd5307eacd8b3516b26f7015a1cf5d7c38d3e14d49427acf688534ec0cdf741
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / braintaichi-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | braintaichi-0.0.5-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 14.2 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e72d803b11008832a8195dde6cfbf09ec96f0455e0f902e6e2d1f9664f83a06e
|
|
BLAKE2b-256 checksum How to use checksums |
3d5644a71b15dbc9611988fe6e89af9e5797d5e0f2376200febef76d8fdd8b75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|