brainpy.math module
Contents
brainpy.math
module#
Basis for Object-oriented Transformations#
|
The BrainPyObject class for whole BrainPy ecosystem. |
|
Transform a Python function as a |
|
A list to represent a dynamically changed numerical sequence in which its element can be changed during JIT compilation. |
A dict to represent a dynamically changed numerical dictionary in which its element can be changed during JIT compilation. |
|
|
The pointer to specify the dynamical variable. |
|
The pointer to specify the parameter. |
|
The pointer to specify the trainable variable. |
|
Object-oriented Transformations#
|
Automatic gradient computation for functions or class objects. |
|
Take vector-valued gradients for function |
|
Extending automatic Jacobian (reverse-mode) of |
|
Extending automatic Jacobian (reverse-mode) of |
|
Extending automatic Jacobian (forward-mode) of |
|
Hessian of |
|
Make a for-loop function, which iterate over inputs. |
|
Make a while-loop function. |
|
Make a condition (if-else) function. |
|
Simple conditional statement (if-else) with instance of |
|
|
|
|
|
|
|
Transform a Python function to |
|
Transform a Python function to a |
|
Transform a Python function into a |
|
JIT (Just-In-Time) compilation for class objects. |
|
Object-oriented JAX transformation for BrainPy computation. |
Brain Dynamics Dedicated Operators#
|
The pre-to-post synaptic summation. |
|
The pre-to-post synaptic production. |
|
The pre-to-post synaptic maximization. |
|
The pre-to-post synaptic minimization. |
|
The pre-to-post synaptic mean computation. |
|
The pre-to-post event-driven synaptic summation with CSR synapse structure. |
|
The pre-to-post synaptic computation with event-driven summation. |
|
The pre-to-post synaptic computation with event-driven production. |
|
The pre-to-syn computation. |
|
The syn-to-post summation computation. |
|
The syn-to-post summation computation. |
|
The syn-to-post product computation. |
|
The syn-to-post maximum computation. |
|
The syn-to-post minimization computation. |
|
The syn-to-post mean computation. |
|
The syn-to-post softmax computation. |
|
Sparse matrix multiplication. |
|
Product of CSR sparse matrix and a dense vector. |
|
The pre-to-post event-driven synaptic summation with CSR synapse structure. |
|
|
|
|
|
|
|
|
|
Creating a XLA custom call operator. |
Activation Functions#
|
Continuously-differentiable exponential linear unit activation. |
|
Exponential linear unit activation function. |
|
Gaussian error linear unit activation function. |
|
Gated linear unit activation function. |
|
Hard \(\mathrm{tanh}\) activation function. |
|
Hard Sigmoid activation function. |
|
Hard SiLU activation function |
|
Hard SiLU activation function |
|
Leaky rectified linear unit activation function. |
|
Log-sigmoid activation function. |
|
Log-Softmax function. |
|
One-hot encodes the given indicies. |
|
Normalizes an array by subtracting mean and dividing by sqrt(var). |
|
|
|
Rectified Linear Unit 6 activation function. |
|
Sigmoid activation function. |
|
Soft-sign activation function. |
|
Softmax function. |
|
Softplus activation function. |
|
SiLU activation function. |
|
SiLU activation function. |
|
Scaled exponential linear unit activation. |
|
Return the identity array. |
|
Compute hyperbolic tangent element-wise. |
Array Operations#
|
Flattens input by reshaping it into a one-dimensional tensor. |
|
|
|
Remove the diagonal of the matrix. |
|
|
|
Return a new array of given shape and type, without initializing entries. |
|
Return a new array with the same shape and type as a given array. |
|
Return a new array of given shape and type, filled with ones. |
|
Return an array of ones with the same shape and type as a given array. |
|
Return a new array of given shape and type, filled with zeros. |
|
Return an array of zeros with the same shape and type as a given array. |
|
Create an array. |
|
Convert the input to an array. |
|
Return evenly spaced values within a given interval. |
|
Return evenly spaced numbers over a specified interval. |
|
Return numbers spaced evenly on a log scale. |
|
Convert the input to a |
|
Convert the input to a |
|
Convert the input to a |
|
Convert the input to a |
|
Convert the input to a |
Delay Variables#
|
Delay variable which has a fixed delay time length. |
|
Delay variable which has a fixed delay length. |
|
Neutral Time Delay. |
|
Neutral Length Delay. |
Environment Settings#
|
Set global default float type. |
Get the default float data type. |
|
|
Set global default integer type. |
|
Get the default int data type. |
|
Set global default boolean type. |
|
Get the default boolean data type. |
|
Set global default complex type. |
Get the default complex data type. |
|
|
Set the default numerical integrator precision. |
|
Get the numerical integrator precision. |
|
Set the default computing mode. |
|
Get the default computing mode. |
|
Set the default computation environment. |
|
Changes platform to CPU, GPU, or TPU. |
Get the computing platform. |
|
By default, XLA considers all CPU cores as one device. |
|
|
Clear all on-device buffers. |
Disable pre-allocating the GPU memory. |
|
Disable pre-allocating the GPU memory. |
|
|
Default int type. |
|
Default float type. |
|
Context-manager that sets a computing environment for brain dynamics computation. |
|
Environment with the batching mode. |
|
Environment with the training mode. |
Computing Modes#
|
Base class for computation Mode |
Normal non-batching mode. |
|
Batching mode. |
|
Training mode requires data batching. |
|
Normal non-batching mode. |
|
Batching mode. |
|
Training mode requires data batching. |