Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add colab link for documentation notebooks #614

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion brainpy/_src/math/compat_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,23 @@ def asfarray(a, dtype=np.float_):
dtype = np.float_
return asarray(a, dtype=dtype)

def in1d(ar1, ar2, assume_unique: bool = False, invert: bool = False) -> Array:
del assume_unique
ar1_flat = ravel(ar1)
ar2_flat = ravel(ar2)
# Note: an algorithm based on searchsorted has better scaling, but in practice
# is very slow on accelerators because it relies on lax control flow. If XLA
# ever supports binary search natively, we should switch to this:
# ar2_flat = jnp.sort(ar2_flat)
# ind = jnp.searchsorted(ar2_flat, ar1_flat)
# if invert:
# return ar1_flat != ar2_flat[ind]
# else:
# return ar1_flat == ar2_flat[ind]
if invert:
return asarray((ar1_flat[:, None] != ar2_flat[None, :]).all(-1))
else:
return asarray((ar1_flat[:, None] == ar2_flat[None, :]).any(-1))

# Others
# ------
Expand Down Expand Up @@ -237,7 +254,6 @@ def asfarray(a, dtype=np.float_):
histogram_bin_edges = _compatible_with_brainpy_array(jnp.histogram_bin_edges)
histogramdd = _compatible_with_brainpy_array(jnp.histogramdd)
i0 = _compatible_with_brainpy_array(jnp.i0)
in1d = _compatible_with_brainpy_array(jnp.in1d)
indices = _compatible_with_brainpy_array(jnp.indices)
insert = _compatible_with_brainpy_array(jnp.insert)
intersect1d = _compatible_with_brainpy_array(jnp.intersect1d)
Expand Down
4 changes: 3 additions & 1 deletion docs/core_concept/brainpy_dynamical_system.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept 2: Dynamical System"
"# Concept 2: Dynamical System\n",
"\n",
"[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brainpy/brainpy/blob/master/docs/core_concept/brainpy_dynamical_system.ipynb)"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion docs/core_concept/brainpy_transform_concept.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
}
},
"source": [
"# Concept 1: Object-oriented Transformation"
"# Concept 1: Object-oriented Transformation\n",
"\n",
"[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brainpy/examples/blob/main/docs/core_concept/brainpy_transform_concept.ipynb)"
]
},
{
Expand Down
247 changes: 134 additions & 113 deletions docs/quickstart/analysis.ipynb

Large diffs are not rendered by default.

278 changes: 159 additions & 119 deletions docs/quickstart/simulation.ipynb

Large diffs are not rendered by default.

240 changes: 147 additions & 93 deletions docs/quickstart/training.ipynb

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions docs/tutorial_FAQs/brainpy_ecosystem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# BrainPy Ecosystem for Brain Dynamics Modeling"
"# BrainPy Ecosystem for Brain Dynamics Modeling\n",
"\n",
"[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brainpy/brainpy/blob/master/docs/tutorial_FAQs/brainpy_ecosystem.ipynb)"
]
},
{
Expand Down Expand Up @@ -54,17 +56,20 @@
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## 《神经计算建模实战》\n",
"\n",
"[《神经计算建模实战》 (Neural Modeling in Action)](https://github.com/c-xy17/NeuralModeling) is a book for brain dynamics modeling based on BrainPy. It introduces the basic concepts and methods of brain dynamics modeling, and provides comprehensive examples for brain dynamics modeling with BrainPy. \n"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## 神经计算建模与编程培训班\n",
"\n",
Expand All @@ -76,10 +81,7 @@
"\n",
"This course is based on the textbook [《神经计算建模实战》 (Neural Modeling in Action)](https://github.com/c-xy17/NeuralModeling), supplemented by BrainPy, and based on the theory of \"theory+practice\" combination of teaching and learning. Through this course, students will master the basic concepts, methods and techniques of neural computation modelling, as well as how to use Python programming language to achieve convenient modelling and efficient simulation of neural systems, laying a solid foundation for future research in the field of neural computation or in the field of brain-like intelligence.\n",
"\n"
],
"metadata": {
"collapsed": false
}
]
}
],
"metadata": {
Expand Down
Loading