Leveraging Taichi Lang to customize brain dynamics operators
Project description
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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file braintaichi-0.0.5-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 373.6 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3fdc330edb27cd00bdc3b313ed2f3f368ffdcfa1b7ca9439f741b54111dbbba
|
|
| MD5 |
0c8e89ce5ac2b446415cc670fad02101
|
|
| BLAKE2b-256 |
73085b70dc4ab6fbd636a6ac3efa7b0987eb3e6159c17c7956d1d59e5d5f4b7c
|
File details
Details for the file braintaichi-0.0.5-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 41.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00b9a5392052939ed21f16f605331b07bf4a28a9efbc601212df80365ec1da07
|
|
| MD5 |
ca688cf97e9bd3dcc86eec4ad1c51862
|
|
| BLAKE2b-256 |
30b192555e20a92394b03b328f6e8e139a2c9f32cb9c0589f668708bbe87a6ec
|
File details
Details for the file braintaichi-0.0.5-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
692a99af729355f0d49a904761366451c555972cf0a7d6a13338cf5856f434bd
|
|
| MD5 |
c9d902b2b78ccfd47f0858e0d07dc8f2
|
|
| BLAKE2b-256 |
39a2254f634f564fdad14ac03de9a3852d7f13d5d3fa5217cb6b76eed852032d
|
File details
Details for the file braintaichi-0.0.5-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 373.2 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45763bd1036738af976bafcdfc0c8dc171966382d50df0ea01d129a764f66d47
|
|
| MD5 |
fbf13e4270bca8c44de4e752a23344fc
|
|
| BLAKE2b-256 |
e4b2b14ce67748913536cee049a2d557ee611c2f52949b0646a47427460fe456
|
File details
Details for the file braintaichi-0.0.5-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 41.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f707eeb1abf4c395c71413b6d37f9b72d1902840d7bf5c196cf7eee3d0adfa7
|
|
| MD5 |
8ba08453a2a42ab32cbece592a27be31
|
|
| BLAKE2b-256 |
d80a325e9b9ec8d67d01aed74a8f31b83afab2809c5274bacb1ff9119ba0d888
|
File details
Details for the file braintaichi-0.0.5-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
824833a3cb850de9c54d967b87ca0fe8a48a02eb3cb9002a34275e39e0a47bb2
|
|
| MD5 |
8da2f0126b7554e75fc7523c18920be7
|
|
| BLAKE2b-256 |
ed9c21e333fba6faf28a7aa6d438f1af35be443b539d48fb639fe06e3a04274b
|
File details
Details for the file braintaichi-0.0.5-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 371.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1877ffc720afcbf62a9e5c3711edd49f43efe673349659f123a16767c253b0d5
|
|
| MD5 |
db1c65df85b20e3571a5bff37942198a
|
|
| BLAKE2b-256 |
7ac29e1401ba7dfc86327a8f830d0cdb43108a835c671c9107e74eb88708ec6f
|
File details
Details for the file braintaichi-0.0.5-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 41.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28dd349effa2f75192c743a6fde10eec32afebf94579ef5a05a3d3f79f768d68
|
|
| MD5 |
a0417c7225e818a55967e8cd76c90639
|
|
| BLAKE2b-256 |
0bd5307eacd8b3516b26f7015a1cf5d7c38d3e14d49427acf688534ec0cdf741
|
File details
Details for the file braintaichi-0.0.5-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: braintaichi-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e72d803b11008832a8195dde6cfbf09ec96f0455e0f902e6e2d1f9664f83a06e
|
|
| MD5 |
8195fe28e508b68936f16b2d1e66b30c
|
|
| BLAKE2b-256 |
3d5644a71b15dbc9611988fe6e89af9e5797d5e0f2376200febef76d8fdd8b75
|