Commit a5e75b2
authored
fix(docs,inputs,rates): repair docs notebooks + Hz-input & RNNCell.reset(batch_size) bugs (#857)
fix(docs,inputs,rates): repair docs notebooks + Hz-input and RNNCell.reset(batch_size) bugs
Re-ran every notebook under docs/ in a memory-capped, sequential sandbox.
Most failures were an artifact of executing against a stale *installed*
brainpy build; the repo source already fixes them. The remainder were genuine
notebook API-drift and two real brainpy bugs.
Notebooks (re-executed green against the repo source):
- tutorial_math/array, Dedicated_Operators: wrap computed / random arrays in
bm.Array so the documented in-place assignment works (bm.random.* and Array
arithmetic now return immutable jax arrays).
- tutorial_math/control_flows: while_loop body returns a tuple matching operands.
- tutorial_math/variables: RandomState.split_keys -> split_key.
- tutorial_FAQs/gotchas_of_brainpy_transforms: tag the intentional "State as a
transform argument" gotcha raises-exception; the "this works" example now
passes a plain array instead of a State.
- tutorial_training/esn_introduction: bp.layers.Reservoir -> bp.dyn.Reservoir.
- tutorial_training/build_training_models: bp.layers.{LSTMCell,NVAR} ->
bp.dyn.*, fix the DeepRNN.update layer chain, and rewrite the SNN example to
the bp.dyn projection API (HalfProjAlignPost / Expon / CUBA / LifRef / Leaky).
- tutorial_advanced/interoperation: wrap b in bm.Array so b.value works.
brainpy fixes (with reproducing tests):
- inputs.sinusoidal_input / square_input: attach Hz (frequency) and ms (time)
units before delegating to braintools, which now rejects bare numbers.
- dyn.rates RNNCell/GRUCell/LSTMCell/ConvLSTM reset_state: accept batch_size as
an alias for batch_or_mode, matching the canonical model.reset(batch_size=...)
convention used by brainpy.dyn neurons.1 parent 01aa0c8 commit a5e75b2
13 files changed
Lines changed: 13500 additions & 1558 deletions
File tree
- brainpy
- dyn/rates
- inputs
- docs
- tutorial_FAQs
- tutorial_advanced
- tutorial_math
- tutorial_toolbox
- tutorial_training
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
| |||
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
239 | 249 | | |
240 | 250 | | |
241 | 251 | | |
| |||
371 | 381 | | |
372 | 382 | | |
373 | 383 | | |
| 384 | + | |
| 385 | + | |
374 | 386 | | |
375 | 387 | | |
376 | 388 | | |
| |||
522 | 534 | | |
523 | 535 | | |
524 | 536 | | |
| 537 | + | |
| 538 | + | |
525 | 539 | | |
526 | 540 | | |
527 | 541 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
205 | 227 | | |
206 | 228 | | |
207 | 229 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
38 | 64 | | |
39 | 65 | | |
40 | 66 | | |
| |||
279 | 305 | | |
280 | 306 | | |
281 | 307 | | |
282 | | - | |
283 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
284 | 312 | | |
285 | 313 | | |
286 | 314 | | |
| |||
305 | 333 | | |
306 | 334 | | |
307 | 335 | | |
308 | | - | |
309 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
310 | 340 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
95 | 121 | | |
96 | 122 | | |
97 | 123 | | |
| |||
0 commit comments