From 20d3144d0ef2d2aa577a31f0058e8b794b36aaf9 Mon Sep 17 00:00:00 2001 From: chaoming Date: Sun, 10 Sep 2023 20:46:16 +0800 Subject: [PATCH] [doc] update docs --- .gitignore | 1 + docs/_templates/class_template.rst | 4 +- docs/_templates/classtemplate.rst | 10 + docs/advanced_tutorials.rst | 8 +- docs/api.rst | 44 +-- docs/apis/analysis.rst | 37 ++ docs/apis/brainpy.rst | 81 ++++ docs/apis/connect.rst | 100 +++++ docs/apis/{ => deprecated}/channels.rst | 0 docs/apis/{ => deprecated}/layers.rst | 0 docs/apis/{ => deprecated}/neurons.rst | 0 docs/apis/{ => deprecated}/rates.rst | 0 docs/apis/{ => deprecated}/synapses.rst | 0 docs/apis/{ => deprecated}/synouts.rst | 0 docs/apis/{ => deprecated}/synplast.rst | 0 docs/apis/dnn.rst | 184 +++++++++ docs/apis/dyn.rst | 232 ++++++++++++ docs/apis/encoding.rst | 16 + docs/apis/initialize.rst | 68 ++++ docs/apis/inputs.rst | 17 + docs/apis/integrators.rst | 205 ++++++++++ docs/apis/losses.rst | 57 +++ docs/apis/math.rst | 481 ++++++++++++++++++++++++ docs/apis/measure.rst | 19 + docs/apis/mixin.rst | 22 ++ docs/apis/optim.rst | 63 ++++ docs/apis/running.rst | 17 + docs/auto_generater.py | 22 +- docs/conf.py | 33 +- 29 files changed, 1672 insertions(+), 49 deletions(-) create mode 100644 docs/_templates/classtemplate.rst create mode 100644 docs/apis/analysis.rst create mode 100644 docs/apis/brainpy.rst create mode 100644 docs/apis/connect.rst rename docs/apis/{ => deprecated}/channels.rst (100%) rename docs/apis/{ => deprecated}/layers.rst (100%) rename docs/apis/{ => deprecated}/neurons.rst (100%) rename docs/apis/{ => deprecated}/rates.rst (100%) rename docs/apis/{ => deprecated}/synapses.rst (100%) rename docs/apis/{ => deprecated}/synouts.rst (100%) rename docs/apis/{ => deprecated}/synplast.rst (100%) create mode 100644 docs/apis/dnn.rst create mode 100644 docs/apis/dyn.rst create mode 100644 docs/apis/encoding.rst create mode 100644 docs/apis/initialize.rst create mode 100644 docs/apis/inputs.rst create mode 100644 docs/apis/integrators.rst create mode 100644 docs/apis/losses.rst create mode 100644 docs/apis/math.rst create mode 100644 docs/apis/measure.rst create mode 100644 docs/apis/mixin.rst create mode 100644 docs/apis/optim.rst create mode 100644 docs/apis/running.rst diff --git a/.gitignore b/.gitignore index dec4fa91d..29424003d 100644 --- a/.gitignore +++ b/.gitignore @@ -225,3 +225,4 @@ cython_debug/ /docs/tutorial_advanced/data/ /my_tests/ /examples/dynamics_simulation/Joglekar_2018_data/ +/docs/apis/deprecated/generated/ diff --git a/docs/_templates/class_template.rst b/docs/_templates/class_template.rst index d9135b2c1..a902dc6d9 100644 --- a/docs/_templates/class_template.rst +++ b/docs/_templates/class_template.rst @@ -5,7 +5,9 @@ .. autoclass:: {{ objname }} - .. automethod:: __init__ + {% for item in methods %} + .. automethod:: {{ item }} + {%- endfor %} {% block methods %} diff --git a/docs/_templates/classtemplate.rst b/docs/_templates/classtemplate.rst new file mode 100644 index 000000000..57b89b777 --- /dev/null +++ b/docs/_templates/classtemplate.rst @@ -0,0 +1,10 @@ +.. role:: hidden + :class: hidden-section +.. currentmodule:: {{ module }} + + +{{ name | underline}} + +.. autoclass:: {{ name }} + :members: + diff --git a/docs/advanced_tutorials.rst b/docs/advanced_tutorials.rst index d2c3df4bb..5c8cba0fd 100644 --- a/docs/advanced_tutorials.rst +++ b/docs/advanced_tutorials.rst @@ -8,8 +8,8 @@ This section contains tutorials that illustrate more advanced features of BrainP :maxdepth: 2 tutorial_advanced/1_advanced_math.rst - tutorial_building/2_interoperation.rst - tutorial_building/3_dedicated_operators.rst - tutorial_building/4_developer_guides.rst - tutorial_building/5_others.rst + tutorial_advanced/2_interoperation.rst + tutorial_advanced/3_dedicated_operators.rst + tutorial_advanced/4_developer_guides.rst + tutorial_advanced/5_others.rst diff --git a/docs/api.rst b/docs/api.rst index 65bc5b088..076ce48c9 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -5,31 +5,31 @@ API Documentation :maxdepth: 1 apis/auto/changelog.rst - apis/auto/brainpy.rst - apis/auto/math.rst - apis/auto/dnn.rst - apis/auto/dyn.rst - apis/auto/integrators.rst - apis/auto/analysis.rst - apis/auto/connect.rst - apis/auto/encoding.rst - apis/auto/initialize.rst - apis/auto/inputs.rst - apis/auto/losses.rst - apis/auto/measure.rst - apis/auto/optim.rst - apis/auto/running.rst - apis/auto/mixin.rst + apis/brainpy.rst + apis/math.rst + apis/dnn.rst + apis/dyn.rst + apis/integrators.rst + apis/analysis.rst + apis/connect.rst + apis/encoding.rst + apis/initialize.rst + apis/inputs.rst + apis/losses.rst + apis/measure.rst + apis/optim.rst + apis/running.rst + apis/mixin.rst The following APIs will no longer be maintained in the future, but you can still use them normally. .. toctree:: :maxdepth: 1 - apis/channels.rst - apis/neurons.rst - apis/rates.rst - apis/synapses.rst - apis/synouts.rst - apis/synplast.rst - apis/layers.rst + apis/deprecated/channels.rst + apis/deprecated/neurons.rst + apis/deprecated/rates.rst + apis/deprecated/synapses.rst + apis/deprecated/synouts.rst + apis/deprecated/synplast.rst + apis/deprecated/layers.rst diff --git a/docs/apis/analysis.rst b/docs/apis/analysis.rst new file mode 100644 index 000000000..897fa46c1 --- /dev/null +++ b/docs/apis/analysis.rst @@ -0,0 +1,37 @@ +``brainpy.analysis`` module +=========================== + +.. currentmodule:: brainpy.analysis +.. automodule:: brainpy.analysis + +.. contents:: + :local: + :depth: 1 + +Low-dimensional Analyzers +------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + PhasePlane1D + PhasePlane2D + Bifurcation1D + Bifurcation2D + FastSlow1D + FastSlow2D + + +High-dimensional Analyzers +-------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + SlowPointFinder + + diff --git a/docs/apis/brainpy.rst b/docs/apis/brainpy.rst new file mode 100644 index 000000000..bff268a11 --- /dev/null +++ b/docs/apis/brainpy.rst @@ -0,0 +1,81 @@ +``brainpy`` module +================== + +.. currentmodule:: brainpy +.. automodule:: brainpy + +.. contents:: + :local: + :depth: 1 + +Numerical Differential Integration +---------------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Integrator + JointEq + IntegratorRunner + odeint + sdeint + fdeint + + +Building Dynamical System +------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + DynamicalSystem + DynSysGroup + Sequential + Network + Dynamic + Projection + + +Simulating Dynamical System +--------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + DSRunner + + +Training Dynamical System +------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + DSTrainer + BPTT + BPFF + OnlineTrainer + ForceTrainer + OfflineTrainer + RidgeTrainer + + +Dynamical System Helpers +------------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + LoopOverTime + + diff --git a/docs/apis/connect.rst b/docs/apis/connect.rst new file mode 100644 index 000000000..9c42fbabb --- /dev/null +++ b/docs/apis/connect.rst @@ -0,0 +1,100 @@ +``brainpy.connect`` module +========================== + +.. currentmodule:: brainpy.connect +.. automodule:: brainpy.connect + +.. contents:: + :local: + :depth: 1 + +Base Connection Classes and Tools +--------------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + set_default_dtype + get_idx_type + mat2coo + mat2csc + mat2csr + csr2csc + csr2mat + csr2coo + coo2csr + coo2csc + coo2mat + coo2mat_num + mat2mat_num + visualizeMat + MAT_DTYPE + IDX_DTYPE + Connector + TwoEndConnector + OneEndConnector + CONN_MAT + PRE_IDS + POST_IDS + PRE2POST + POST2PRE + PRE2SYN + POST2SYN + SUPPORTED_SYN_STRUCTURE + + +Custom Connections +------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + MatConn + IJConn + CSRConn + SparseMatConn + + +Random Connections +------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + FixedProb + FixedPreNum + FixedPostNum + FixedTotalNum + GaussianProb + ProbDist + SmallWorld + ScaleFreeBA + ScaleFreeBADual + PowerLaw + + +Regular Connections +------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + One2One + All2All + GridFour + GridEight + GridN + one2one + all2all + grid_four + grid_eight + + diff --git a/docs/apis/channels.rst b/docs/apis/deprecated/channels.rst similarity index 100% rename from docs/apis/channels.rst rename to docs/apis/deprecated/channels.rst diff --git a/docs/apis/layers.rst b/docs/apis/deprecated/layers.rst similarity index 100% rename from docs/apis/layers.rst rename to docs/apis/deprecated/layers.rst diff --git a/docs/apis/neurons.rst b/docs/apis/deprecated/neurons.rst similarity index 100% rename from docs/apis/neurons.rst rename to docs/apis/deprecated/neurons.rst diff --git a/docs/apis/rates.rst b/docs/apis/deprecated/rates.rst similarity index 100% rename from docs/apis/rates.rst rename to docs/apis/deprecated/rates.rst diff --git a/docs/apis/synapses.rst b/docs/apis/deprecated/synapses.rst similarity index 100% rename from docs/apis/synapses.rst rename to docs/apis/deprecated/synapses.rst diff --git a/docs/apis/synouts.rst b/docs/apis/deprecated/synouts.rst similarity index 100% rename from docs/apis/synouts.rst rename to docs/apis/deprecated/synouts.rst diff --git a/docs/apis/synplast.rst b/docs/apis/deprecated/synplast.rst similarity index 100% rename from docs/apis/synplast.rst rename to docs/apis/deprecated/synplast.rst diff --git a/docs/apis/dnn.rst b/docs/apis/dnn.rst new file mode 100644 index 000000000..736066ce4 --- /dev/null +++ b/docs/apis/dnn.rst @@ -0,0 +1,184 @@ +``brainpy.dnn`` module +====================== + +.. currentmodule:: brainpy.dnn +.. automodule:: brainpy.dnn + +.. contents:: + :local: + :depth: 1 + +Non-linear Activations +---------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Activation + Flatten + FunAsLayer + Threshold + ReLU + RReLU + Hardtanh + ReLU6 + Sigmoid + Hardsigmoid + Tanh + SiLU + Mish + Hardswish + ELU + CELU + SELU + GLU + GELU + Hardshrink + LeakyReLU + LogSigmoid + Softplus + Softshrink + PReLU + Softsign + Tanhshrink + Softmin + Softmax + Softmax2d + LogSoftmax + + +Convolutional Layers +-------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Conv1d + Conv2d + Conv3d + Conv1D + Conv2D + Conv3D + ConvTranspose1d + ConvTranspose2d + ConvTranspose3d + + +Dense Connection Layers +----------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Dense + Linear + Identity + AllToAll + OneToOne + MaskedLinear + CSRLinear + EventCSRLinear + JitFPHomoLinear + JitFPUniformLinear + JitFPNormalLinear + EventJitFPHomoLinear + EventJitFPNormalLinear + EventJitFPUniformLinear + + +Normalization Layers +-------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + BatchNorm1d + BatchNorm2d + BatchNorm3d + BatchNorm1D + BatchNorm2D + BatchNorm3D + LayerNorm + GroupNorm + InstanceNorm + + +Pooling Layers +-------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + MaxPool + MaxPool1d + MaxPool2d + MaxPool3d + MinPool + AvgPool + AvgPool1d + AvgPool2d + AvgPool3d + AdaptiveAvgPool1d + AdaptiveAvgPool2d + AdaptiveAvgPool3d + AdaptiveMaxPool1d + AdaptiveMaxPool2d + AdaptiveMaxPool3d + + +Artificial Recurrent Layers +--------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + NVAR + Reservoir + RNNCell + GRUCell + LSTMCell + Conv1dLSTMCell + Conv2dLSTMCell + Conv3dLSTMCell + + +Interoperation with Flax +------------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + FromFlax + ToFlaxRNNCell + ToFlax + + +Other Layers +------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Layer + Dropout + Activation + Flatten + FunAsLayer + + diff --git a/docs/apis/dyn.rst b/docs/apis/dyn.rst new file mode 100644 index 000000000..bee767849 --- /dev/null +++ b/docs/apis/dyn.rst @@ -0,0 +1,232 @@ +``brainpy.dyn`` module +====================== + +.. currentmodule:: brainpy.dyn +.. automodule:: brainpy.dyn + +.. contents:: + :local: + :depth: 1 + +Base Classes +------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + NeuDyn + SynDyn + IonChaDyn + + +Ion Dynamics +------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + mix_ions + Ion + MixIons + Calcium + CalciumFixed + CalciumDetailed + CalciumFirstOrder + Sodium + SodiumFixed + Potassium + PotassiumFixed + + +Ion Channel Dynamics +-------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + IonChannel + CalciumChannel + ICaN_IS2008 + ICaT_HM1992 + ICaT_HP1992 + ICaHT_HM1992 + ICaHT_Re1993 + ICaL_IS2008 + PotassiumChannel + IKDR_Ba2002v2 + IK_TM1991v2 + IK_HH1952v2 + IKA1_HM1992v2 + IKA2_HM1992v2 + IKK2A_HM1992v2 + IKK2B_HM1992v2 + IKNI_Ya1989v2 + IK_Leak + IKDR_Ba2002 + IK_TM1991 + IK_HH1952 + IKA1_HM1992 + IKA2_HM1992 + IKK2A_HM1992 + IKK2B_HM1992 + IKNI_Ya1989 + IKL + Ih_HM1992 + Ih_De1996 + IAHP_De1994v2 + IAHP_De1994 + SodiumChannel + INa_Ba2002 + INa_TM1991 + INa_HH1952 + INa_Ba2002v2 + INa_TM1991v2 + INa_HH1952v2 + LeakyChannel + IL + + +Neuron Dynamics +--------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Lif + LifLTC + LifRefLTC + LifRef + ExpIF + ExpIFLTC + ExpIFRefLTC + ExpIFRef + AdExIF + AdExIFLTC + AdExIFRefLTC + AdExIFRef + QuaIF + QuaIFLTC + QuaIFRefLTC + QuaIFRef + AdQuaIF + AdQuaIFLTC + AdQuaIFRefLTC + AdQuaIFRef + Gif + GifLTC + GifRefLTC + GifRef + Izhikevich + IzhikevichLTC + IzhikevichRefLTC + IzhikevichRef + HHTypedNeuron + CondNeuGroupLTC + CondNeuGroup + HH + HHLTC + MorrisLecar + MorrisLecarLTC + WangBuzsakiHH + WangBuzsakiHHLTC + + +Synaptic Dynamics +----------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Delta + Expon + Alpha + DualExpon + DualExponV2 + NMDA + STD + STP + AMPA + GABAa + BioNMDA + DiffusiveCoupling + AdditiveCoupling + + +Synaptic Projections +-------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + VanillaProj + ProjAlignPostMg1 + ProjAlignPostMg2 + ProjAlignPost1 + ProjAlignPost2 + ProjAlignPreMg1 + ProjAlignPreMg2 + ProjAlignPre1 + ProjAlignPre2 + SynConn + PoissonInput + + +Common Dynamical Models +----------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Leaky + Integrator + InputGroup + OutputGroup + SpikeTimeGroup + PoissonGroup + OUProcess + + +Synaptic Output Models +---------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + SynOut + COBA + CUBA + MgBlock + + +Population Rate Models +---------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + FHN + FeedbackFHN + QIF + StuartLandauOscillator + WilsonCowanModel + ThresholdLinearModel + + diff --git a/docs/apis/encoding.rst b/docs/apis/encoding.rst new file mode 100644 index 000000000..23736b1af --- /dev/null +++ b/docs/apis/encoding.rst @@ -0,0 +1,16 @@ +``brainpy.encoding`` module +=========================== + +.. currentmodule:: brainpy.encoding +.. automodule:: brainpy.encoding + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Encoder + LatencyEncoder + WeightedPhaseEncoder + PoissonEncoder + DiffEncoder diff --git a/docs/apis/initialize.rst b/docs/apis/initialize.rst new file mode 100644 index 000000000..fcce922c8 --- /dev/null +++ b/docs/apis/initialize.rst @@ -0,0 +1,68 @@ +``brainpy.initialize`` module +============================= + +.. currentmodule:: brainpy.initialize +.. automodule:: brainpy.initialize + +.. contents:: + :local: + :depth: 1 + +Basic Initialization Classes +---------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Initializer + + +Regular Initializers +-------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + ZeroInit + Constant + OneInit + Identity + + +Random Initializers +------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Normal + Uniform + VarianceScaling + KaimingUniform + KaimingNormal + XavierUniform + XavierNormal + LecunUniform + LecunNormal + Orthogonal + DeltaOrthogonal + + +Decay Initializers +------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + GaussianDecay + DOGDecay + + diff --git a/docs/apis/inputs.rst b/docs/apis/inputs.rst new file mode 100644 index 000000000..e05372e8c --- /dev/null +++ b/docs/apis/inputs.rst @@ -0,0 +1,17 @@ +``brainpy.inputs`` module +========================= + +.. currentmodule:: brainpy.inputs +.. automodule:: brainpy.inputs + +.. autosummary:: + :toctree: generated/ + + section_input + constant_input + spike_input + ramp_input + wiener_process + ou_process + sinusoidal_input + square_input diff --git a/docs/apis/integrators.rst b/docs/apis/integrators.rst new file mode 100644 index 000000000..187b4e9a4 --- /dev/null +++ b/docs/apis/integrators.rst @@ -0,0 +1,205 @@ +``brainpy.integrators`` module +============================== + +.. currentmodule:: brainpy.integrators +.. automodule:: brainpy.integrators + +.. contents:: + :local: + :depth: 2 + +ODE integrators +--------------- + +.. currentmodule:: brainpy.integrators.ode +.. automodule:: brainpy.integrators.ode + +Base ODE Integrator +~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + ODEIntegrator + + +Generic ODE Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + set_default_odeint + get_default_odeint + register_ode_integrator + get_supported_methods + + +Explicit Runge-Kutta ODE Integrators +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + ExplicitRKIntegrator + Euler + MidPoint + Heun2 + Ralston2 + RK2 + RK3 + Heun3 + Ralston3 + SSPRK3 + RK4 + Ralston4 + RK4Rule38 + + +Adaptive Runge-Kutta ODE Integrators +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + AdaptiveRKIntegrator + RKF12 + RKF45 + DormandPrince + CashKarp + BogackiShampine + HeunEuler + + +Exponential ODE Integrators +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + ExponentialEuler + + +SDE integrators +--------------- + +.. currentmodule:: brainpy.integrators.sde +.. automodule:: brainpy.integrators.sde + +Base SDE Integrator +~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + SDEIntegrator + + +Generic SDE Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + set_default_sdeint + get_default_sdeint + register_sde_integrator + get_supported_methods + + +Normal SDE Integrators +~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Euler + Heun + Milstein + MilsteinGradFree + ExponentialEuler + + +SRK methods for scalar Wiener process +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + SRK1W1 + SRK2W1 + KlPl + + +FDE integrators +--------------- + +.. currentmodule:: brainpy.integrators.fde +.. automodule:: brainpy.integrators.fde + +Base FDE Integrator +~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + FDEIntegrator + + +Generic FDE Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + set_default_fdeint + get_default_fdeint + register_fde_integrator + get_supported_methods + + +Methods for Caputo Fractional Derivative +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + CaputoEuler + CaputoL1Schema + + +Methods for Riemann-Liouville Fractional Derivative +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + GLShortMemory + + diff --git a/docs/apis/losses.rst b/docs/apis/losses.rst new file mode 100644 index 000000000..8f50c487f --- /dev/null +++ b/docs/apis/losses.rst @@ -0,0 +1,57 @@ +``brainpy.losses`` module +========================= + +.. currentmodule:: brainpy.losses +.. automodule:: brainpy.losses + +.. contents:: + :local: + :depth: 1 + +Comparison +---------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + cross_entropy_loss + cross_entropy_sparse + cross_entropy_sigmoid + nll_loss + l1_loss + l2_loss + huber_loss + mean_absolute_error + mean_squared_error + mean_squared_log_error + binary_logistic_loss + multiclass_logistic_loss + sigmoid_binary_cross_entropy + softmax_cross_entropy + log_cosh_loss + ctc_loss_with_forward_probs + ctc_loss + CrossEntropyLoss + NLLLoss + L1Loss + MAELoss + MSELoss + + +Regularization +-------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + l2_norm + mean_absolute + mean_square + log_cosh + smooth_labels + + diff --git a/docs/apis/math.rst b/docs/apis/math.rst new file mode 100644 index 000000000..49c15ad85 --- /dev/null +++ b/docs/apis/math.rst @@ -0,0 +1,481 @@ +``brainpy.math`` module +======================= + +.. contents:: + :local: + :depth: 1 + +Objects and Variables +--------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + BrainPyObject + FunAsObject + Partial + NodeList + NodeDict + node_dict + node_list + Variable + Parameter + TrainVar + VariableView + VarList + VarDict + var_list + var_dict + + +Object-oriented Transformations +------------------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + grad + vector_grad + jacobian + jacrev + jacfwd + hessian + make_loop + make_while + make_cond + cond + ifelse + for_loop + while_loop + jit + cls_jit + to_object + function + + +Environment Settings +-------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + set + set_environment + set_float + get_float + set_int + get_int + set_bool + get_bool + set_complex + get_complex + set_dt + get_dt + set_mode + get_mode + enable_x64 + disable_x64 + set_platform + get_platform + set_host_device_count + clear_buffer_memory + enable_gpu_memory_preallocation + disable_gpu_memory_preallocation + ditype + dftype + environment + batching_environment + training_environment + + +Array Interoperability +---------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + as_device_array + as_jax + as_ndarray + as_numpy + as_variable + + +Operators for Pre-Syn-Post Conversion +------------------------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + pre2post_sum + pre2post_prod + pre2post_max + pre2post_min + pre2post_mean + pre2post_event_sum + pre2post_csr_event_sum + pre2post_coo_event_sum + pre2syn + syn2post_sum + syn2post + syn2post_prod + syn2post_max + syn2post_min + syn2post_mean + syn2post_softmax + + +Activation Functions +-------------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + celu + elu + gelu + glu + prelu + silu + selu + relu + relu6 + rrelu + hard_silu + leaky_relu + hard_tanh + hard_sigmoid + tanh_shrink + hard_swish + hard_shrink + soft_sign + soft_shrink + softmax + softmin + softplus + swish + mish + log_sigmoid + log_softmax + one_hot + normalize + sigmoid + identity + tanh + + +Delay Variables +--------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + TimeDelay + LengthDelay + NeuTimeDelay + NeuLenDelay + ROTATE_UPDATE + CONCAT_UPDATE + + +Computing Modes +--------------- + +.. currentmodule:: brainpy.math +.. automodule:: brainpy.math + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Mode + NonBatchingMode + BatchingMode + TrainingMode + nonbatching_mode + batching_mode + training_mode + + +``brainpy.math.sparse`` module: Sparse Operators +------------------------------------------------ + +.. currentmodule:: brainpy.math.sparse +.. automodule:: brainpy.math.sparse + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + csrmv + coomv + seg_matmul + csr_to_dense + csr_to_coo + coo_to_csr + + +``brainpy.math.event`` module: Event-driven Operators +----------------------------------------------------- + +.. currentmodule:: brainpy.math.event +.. automodule:: brainpy.math.event + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + csrmv + info + + +``brainpy.math.jitconn`` module: Just-In-Time Connectivity Operators +-------------------------------------------------------------------- + +.. currentmodule:: brainpy.math.jitconn +.. automodule:: brainpy.math.jitconn + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + event_mv_prob_homo + event_mv_prob_uniform + event_mv_prob_normal + mv_prob_homo + mv_prob_uniform + mv_prob_normal + + +``brainpy.math.surrogate`` module: Surrogate Gradient Functions +--------------------------------------------------------------- + +.. currentmodule:: brainpy.math.surrogate +.. automodule:: brainpy.math.surrogate + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Surrogate + Sigmoid + PiecewiseQuadratic + PiecewiseExp + SoftSign + Arctan + NonzeroSignLog + ERF + PiecewiseLeakyRelu + SquarewaveFourierSeries + S2NN + QPseudoSpike + LeakyRelu + LogTailedRelu + ReluGrad + GaussianGrad + InvSquareGrad + MultiGaussianGrad + SlayerGrad + sigmoid + piecewise_quadratic + piecewise_exp + soft_sign + arctan + nonzero_sign_log + erf + piecewise_leaky_relu + squarewave_fourier_series + s2nn + q_pseudo_spike + leaky_relu + log_tailed_relu + relu_grad + gaussian_grad + inv_square_grad + multi_gaussian_grad + slayer_grad + inv_square_grad2 + relu_grad2 + + +``brainpy.math.random`` module: Random Number Generations +--------------------------------------------------------- + +.. currentmodule:: brainpy.math.random +.. automodule:: brainpy.math.random + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + seed + split_key + split_keys + default_rng + rand + randint + random_integers + randn + random + random_sample + ranf + sample + choice + permutation + shuffle + beta + exponential + gamma + gumbel + laplace + logistic + normal + pareto + poisson + standard_cauchy + standard_exponential + standard_gamma + standard_normal + standard_t + uniform + truncated_normal + bernoulli + lognormal + binomial + chisquare + dirichlet + geometric + f + hypergeometric + logseries + multinomial + multivariate_normal + negative_binomial + noncentral_chisquare + noncentral_f + power + rayleigh + triangular + vonmises + wald + weibull + weibull_min + zipf + maxwell + t + orthogonal + loggamma + categorical + rand_like + randint_like + randn_like + RandomState + Generator + DEFAULT + + +``brainpy.math.linalg`` module: Linear algebra +---------------------------------------------- + +.. currentmodule:: brainpy.math.linalg +.. automodule:: brainpy.math.linalg + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + cholesky + cond + det + eig + eigh + eigvals + eigvalsh + inv + svd + lstsq + matrix_power + matrix_rank + norm + pinv + qr + solve + slogdet + tensorinv + tensorsolve + multi_dot + + +``brainpy.math.fft`` module: Discrete Fourier Transform +------------------------------------------------------- + +.. currentmodule:: brainpy.math.fft +.. automodule:: brainpy.math.fft + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + fft + fft2 + fftfreq + fftn + fftshift + hfft + ifft + ifft2 + ifftn + ifftshift + ihfft + irfft + irfft2 + irfftn + rfft + rfft2 + rfftfreq + rfftn + + diff --git a/docs/apis/measure.rst b/docs/apis/measure.rst new file mode 100644 index 000000000..931e53947 --- /dev/null +++ b/docs/apis/measure.rst @@ -0,0 +1,19 @@ +``brainpy.measure`` module +========================== + +.. currentmodule:: brainpy.measure +.. automodule:: brainpy.measure + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + cross_correlation + voltage_fluctuation + matrix_correlation + weighted_correlation + functional_connectivity + raster_plot + firing_rate + unitary_LFP diff --git a/docs/apis/mixin.rst b/docs/apis/mixin.rst new file mode 100644 index 000000000..d797bb37a --- /dev/null +++ b/docs/apis/mixin.rst @@ -0,0 +1,22 @@ +``brainpy.mixin`` module +======================== + +.. currentmodule:: brainpy.mixin +.. automodule:: brainpy.mixin + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + + MixIn + ReceiveInputProj + AlignPost + AutoDelaySupp + ParamDesc + ParamDescInit + BindCondData + Container + TreeNode + JointType diff --git a/docs/apis/optim.rst b/docs/apis/optim.rst new file mode 100644 index 000000000..49b09e594 --- /dev/null +++ b/docs/apis/optim.rst @@ -0,0 +1,63 @@ +``brainpy.optim`` module +======================== + +.. currentmodule:: brainpy.optim +.. automodule:: brainpy.optim + +.. contents:: + :local: + :depth: 1 + +Optimizers +---------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + Optimizer + SGD + Momentum + MomentumNesterov + Adagrad + Adadelta + RMSProp + Adam + LARS + Adan + AdamW + + +Schedulers +---------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + make_schedule + partial + BrainPyObject + MathError + Scheduler + Constant + CallBasedScheduler + StepLR + MultiStepLR + CosineAnnealingLR + CosineAnnealingWarmRestarts + ExponentialLR + ExponentialDecayLR + ExponentialDecay + InverseTimeDecayLR + InverseTimeDecay + PolynomialDecayLR + PolynomialDecay + PiecewiseConstantLR + PiecewiseConstant + Sequence + Union + + diff --git a/docs/apis/running.rst b/docs/apis/running.rst new file mode 100644 index 000000000..aa46ca6d7 --- /dev/null +++ b/docs/apis/running.rst @@ -0,0 +1,17 @@ +``brainpy.running`` module +========================== + +.. currentmodule:: brainpy.running +.. automodule:: brainpy.running + +.. autosummary:: + :toctree: generated/ + :nosignatures: + :template: classtemplate.rst + + jax_vectorize_map + jax_parallelize_map + process_pool + process_pool_lock + cpu_ordered_parallel + cpu_unordered_parallel diff --git a/docs/auto_generater.py b/docs/auto_generater.py index 3cccc347f..cbbb06df1 100644 --- a/docs/auto_generater.py +++ b/docs/auto_generater.py @@ -43,7 +43,7 @@ def _write_module(module_name, filename, header=None, template=False): # write autosummary fout.write('.. autosummary::\n') if template: - fout.write(' :template: class_template.rst\n') + fout.write(' :template: classtemplate.rst\n') fout.write(' :toctree: generated/\n\n') for m in functions: fout.write(f' {m}\n') @@ -77,7 +77,9 @@ def _write_submodules(module_name, filename, header=None, submodule_names=(), se # write autosummary fout.write('.. autosummary::\n') - fout.write(' :toctree: generated/\n\n') + fout.write(' :toctree: generated/\n') + fout.write(' :nosignatures:\n') + fout.write(' :template: classtemplate.rst\n\n') for m in functions: fout.write(f' {m}\n') for m in classes: @@ -109,7 +111,9 @@ def _write_subsections(module_name, fout.write(name + '\n') fout.write('-' * len(name) + '\n\n') fout.write('.. autosummary::\n') - fout.write(' :toctree: generated/\n\n') + fout.write(' :toctree: generated/\n') + fout.write(' :nosignatures:\n') + fout.write(' :template: classtemplate.rst\n\n') for m in values: fout.write(f' {m}\n') fout.write(f'\n\n') @@ -140,7 +144,9 @@ def _write_subsections_v2(module_path, fout.write(subheader + '\n') fout.write('-' * len(subheader) + '\n\n') fout.write('.. autosummary::\n') - fout.write(' :toctree: generated/\n\n') + fout.write(' :toctree: generated/\n') + fout.write(' :nosignatures:\n') + fout.write(' :template: classtemplate.rst\n\n') for m in functions: fout.write(f' {m}\n') for m in classes: @@ -182,7 +188,9 @@ def _write_subsections_v3(module_path, fout.write(subheader + '\n') fout.write('~' * len(subheader) + '\n\n') fout.write('.. autosummary::\n') - fout.write(' :toctree: generated/\n\n') + fout.write(' :toctree: generated/\n') + fout.write(' :nosignatures:\n') + fout.write(' :template: classtemplate.rst\n\n') for m in functions: fout.write(f' {m}\n') for m in classes: @@ -220,7 +228,9 @@ def _write_subsections_v4(module_path, fout.write('.. autosummary::\n') - fout.write(' :toctree: generated/\n\n') + fout.write(' :toctree: generated/\n') + fout.write(' :nosignatures:\n') + fout.write(' :template: classtemplate.rst\n\n') for m in functions: fout.write(f' {m}\n') for m in classes: diff --git a/docs/conf.py b/docs/conf.py index 8853c8b1f..19b1ab5bc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,25 +18,26 @@ sys.path.insert(0, os.path.abspath('../')) import brainpy -from docs import auto_generater os.makedirs('apis/auto/', exist_ok=True) -auto_generater.generate_analysis_docs() -auto_generater.generate_connect_docs() -auto_generater.generate_encoding_docs() -auto_generater.generate_initialize_docs() -auto_generater.generate_inputs_docs() -auto_generater.generate_dnn_docs() -auto_generater.generate_dyn_docs() -auto_generater.generate_losses_docs() -auto_generater.generate_measure_docs() -auto_generater.generate_optim_docs() -auto_generater.generate_running_docs() -auto_generater.generate_brainpy_docs() -auto_generater.generate_integrators_doc() -auto_generater.generate_math_docs() -auto_generater.generate_mixin_docs() +# from docs import auto_generater +# auto_generater.generate_analysis_docs() +# auto_generater.generate_connect_docs() +# auto_generater.generate_encoding_docs() +# auto_generater.generate_initialize_docs() +# auto_generater.generate_inputs_docs() +# auto_generater.generate_dnn_docs() +# auto_generater.generate_dyn_docs() +# auto_generater.generate_losses_docs() +# auto_generater.generate_measure_docs() +# auto_generater.generate_optim_docs() +# auto_generater.generate_running_docs() +# auto_generater.generate_brainpy_docs() +# auto_generater.generate_integrators_doc() +# auto_generater.generate_math_docs() +# auto_generater.generate_mixin_docs() +# sys.exit() changelogs = [ ('../changelog.rst', 'apis/auto/changelog.rst'),