|
3 | 3 |
|
4 | 4 | __version__ = "3.0.0" |
5 | 5 |
|
| 6 | +# Part: Toolbox # |
| 7 | +# --------------- # |
| 8 | +# modules of toolbox |
| 9 | +from brainpy import ( |
| 10 | + connect, # synaptic connection |
| 11 | + initialize, # weight initialization |
| 12 | + optim, # gradient descent optimizers |
| 13 | + losses, # loss functions |
| 14 | + measure, # methods for data analysis |
| 15 | + inputs, # methods for generating input currents |
| 16 | + encoding, # encoding schema |
| 17 | + checkpoints, # checkpoints |
| 18 | + check, # error checking |
| 19 | + mixin, # mixin classes |
| 20 | + algorithms, # online or offline training algorithms |
| 21 | +) |
6 | 22 | # fundamental supporting modules |
7 | 23 | from brainpy import errors, check, tools |
8 | 24 |
|
9 | | -try: |
10 | | - import jaxlib |
11 | | - del jaxlib |
12 | | -except ModuleNotFoundError: |
13 | | - raise ModuleNotFoundError(tools.jaxlib_install_info) from None |
14 | | - |
15 | | -# Part: Math Foundation # |
16 | | -# ----------------------- # |
17 | | - |
18 | 25 | # math foundation |
19 | 26 | from brainpy import math |
20 | 27 | from .math import BrainPyObject |
21 | 28 |
|
22 | | -# Part: Toolbox # |
23 | | -# --------------- # |
24 | | -# modules of toolbox |
25 | | -from brainpy import ( |
26 | | - connect, # synaptic connection |
27 | | - initialize, # weight initialization |
28 | | - optim, # gradient descent optimizers |
29 | | - losses, # loss functions |
30 | | - measure, # methods for data analysis |
31 | | - inputs, # methods for generating input currents |
32 | | - encoding, # encoding schema |
33 | | - checkpoints, # checkpoints |
34 | | - check, # error checking |
35 | | - mixin, # mixin classes |
36 | | - algorithms, # online or offline training algorithms |
37 | | -) |
| 29 | +# Part: Math Foundation # |
| 30 | +# ----------------------- # |
38 | 31 |
|
39 | 32 | # convenient alias |
40 | 33 | conn = connect |
|
50 | 43 | from brainpy._src.integrators.sde.generic import (sdeint as sdeint) |
51 | 44 | from brainpy._src.integrators.fde.generic import (fdeint as fdeint) |
52 | 45 |
|
53 | | - |
54 | 46 | # Part: Models # |
55 | 47 | # -------------- # |
56 | 48 |
|
57 | 49 | # base classes |
58 | 50 | from brainpy._src.dynsys import ( |
59 | | - DynamicalSystem as DynamicalSystem, |
60 | | - DynSysGroup as DynSysGroup, # collectors |
61 | | - Sequential as Sequential, |
62 | | - Dynamic as Dynamic, # category |
63 | | - Projection as Projection, |
64 | | - receive_update_input, # decorators |
65 | | - receive_update_output, |
66 | | - not_receive_update_input, |
67 | | - not_receive_update_output, |
| 51 | + DynamicalSystem as DynamicalSystem, |
| 52 | + DynSysGroup as DynSysGroup, # collectors |
| 53 | + Sequential as Sequential, |
| 54 | + Dynamic as Dynamic, # category |
| 55 | + Projection as Projection, |
| 56 | + receive_update_input, # decorators |
| 57 | + receive_update_output, |
| 58 | + not_receive_update_input, |
| 59 | + not_receive_update_output, |
68 | 60 | ) |
| 61 | + |
69 | 62 | DynamicalSystemNS = DynamicalSystem |
70 | 63 | Network = DynSysGroup |
71 | 64 | # delays |
72 | 65 | from brainpy._src.delay import ( |
73 | | - VarDelay as VarDelay, |
| 66 | + VarDelay as VarDelay, |
74 | 67 | ) |
75 | 68 |
|
76 | 69 | # building blocks |
77 | 70 | from brainpy import ( |
78 | | - dnn, layers, # module for dnn layers |
79 | | - dyn, # module for modeling dynamics |
| 71 | + dnn, layers, # module for dnn layers |
| 72 | + dyn, # module for modeling dynamics |
80 | 73 | ) |
| 74 | + |
81 | 75 | NeuGroup = NeuGroupNS = dyn.NeuDyn |
82 | 76 |
|
83 | 77 | # common tools |
|
94 | 88 | from brainpy._src.transform import (LoopOverTime as LoopOverTime, ) |
95 | 89 | from brainpy import (running as running) |
96 | 90 |
|
97 | | - |
98 | 91 | # Part: Training # |
99 | 92 | # ---------------- # |
100 | 93 | from brainpy._src.train.base import (DSTrainer as DSTrainer, ) |
101 | 94 | from brainpy._src.train.back_propagation import (BPTT as BPTT, |
102 | | - BPFF as BPFF,) |
| 95 | + BPFF as BPFF, ) |
103 | 96 | from brainpy._src.train.online import (OnlineTrainer as OnlineTrainer, |
104 | 97 | ForceTrainer as ForceTrainer, ) |
105 | 98 | from brainpy._src.train.offline import (OfflineTrainer as OfflineTrainer, |
106 | 99 | RidgeTrainer as RidgeTrainer, ) |
107 | 100 |
|
108 | | - |
109 | 101 | # Part: Analysis # |
110 | 102 | # ---------------- # |
111 | 103 | from brainpy import (analysis as analysis) |
112 | 104 |
|
113 | | - |
114 | 105 | # Part: Others # |
115 | 106 | # ---------------- # |
116 | 107 | from brainpy._src.visualization import (visualize as visualize) |
117 | 108 |
|
118 | | - |
119 | 109 | # Part: Deprecations # |
120 | 110 | # -------------------- # |
121 | 111 | from brainpy._src import train |
122 | 112 | from brainpy import ( |
123 | | - channels, # channel models |
124 | | - neurons, # neuron groups |
125 | | - synapses, # synapses |
126 | | - rates, # rate models |
127 | | - experimental, |
128 | | - synouts, # synaptic output |
129 | | - synplast, # synaptic plasticity |
| 113 | + channels, # channel models |
| 114 | + neurons, # neuron groups |
| 115 | + synapses, # synapses |
| 116 | + rates, # rate models |
| 117 | + experimental, |
| 118 | + synouts, # synaptic output |
| 119 | + synplast, # synaptic plasticity |
130 | 120 | ) |
131 | 121 | from brainpy._src import modes |
132 | | -from brainpy._src.math.object_transform.base import (Base as Base, |
133 | | - ArrayCollector as ArrayCollector, |
134 | | - Collector as Collector, ) |
| 122 | +from brainpy._src.math.object_transform.base import ( |
| 123 | + Base as Base, |
| 124 | + ArrayCollector as ArrayCollector, |
| 125 | + Collector as Collector, |
| 126 | +) |
135 | 127 |
|
136 | 128 | # deprecated |
137 | 129 | from brainpy._add_deprecations import deprecation_getattr2 |
138 | 130 |
|
139 | 131 | __deprecations = { |
140 | | - 'Module': ('brainpy.Module', 'brainpy.DynamicalSystem', DynamicalSystem), |
141 | | - 'Channel': ('brainpy.Channel', 'brainpy.dyn.IonChannel', dyn.IonChannel), |
142 | | - 'SynConn': ('brainpy.SynConn', 'brainpy.dyn.SynConn', dyn.SynConn), |
143 | | - 'Container': ('brainpy.Container', 'brainpy.DynSysGroup', DynSysGroup), |
144 | | - |
145 | | - 'optimizers': ('brainpy.optimizers', 'brainpy.optim', optim), |
146 | | - 'TensorCollector': ('brainpy.TensorCollector', 'brainpy.ArrayCollector', ArrayCollector), |
147 | | - 'SynSTP': ('brainpy.SynSTP', 'brainpy.synapses.SynSTP', synapses.SynSTP), |
148 | | - 'SynOut': ('brainpy.SynOut', 'brainpy.synapses.SynOut', synapses.SynOut), |
149 | | - 'TwoEndConn': ('brainpy.TwoEndConn', 'brainpy.synapses.TwoEndConn', synapses.TwoEndConn), |
150 | | - 'CondNeuGroup': ('brainpy.CondNeuGroup', 'brainpy.dyn.CondNeuGroup', dyn.CondNeuGroup), |
| 132 | + 'Module': ('brainpy.Module', 'brainpy.DynamicalSystem', DynamicalSystem), |
| 133 | + 'Channel': ('brainpy.Channel', 'brainpy.dyn.IonChannel', dyn.IonChannel), |
| 134 | + 'SynConn': ('brainpy.SynConn', 'brainpy.dyn.SynConn', dyn.SynConn), |
| 135 | + 'Container': ('brainpy.Container', 'brainpy.DynSysGroup', DynSysGroup), |
| 136 | + |
| 137 | + 'optimizers': ('brainpy.optimizers', 'brainpy.optim', optim), |
| 138 | + 'TensorCollector': ('brainpy.TensorCollector', 'brainpy.ArrayCollector', ArrayCollector), |
| 139 | + 'SynSTP': ('brainpy.SynSTP', 'brainpy.synapses.SynSTP', synapses.SynSTP), |
| 140 | + 'SynOut': ('brainpy.SynOut', 'brainpy.synapses.SynOut', synapses.SynOut), |
| 141 | + 'TwoEndConn': ('brainpy.TwoEndConn', 'brainpy.synapses.TwoEndConn', synapses.TwoEndConn), |
| 142 | + 'CondNeuGroup': ('brainpy.CondNeuGroup', 'brainpy.dyn.CondNeuGroup', dyn.CondNeuGroup), |
151 | 143 | } |
152 | 144 | __getattr__ = deprecation_getattr2('brainpy', __deprecations) |
153 | 145 |
|
|
0 commit comments