Neurons¶
btorch.models.neurons
¶
Attributes¶
__all__ = ['LIF', 'ALIF', 'ELIF', 'GLIF3', 'Izhikevich']
module-attribute
¶
Classes¶
ALIF
¶
Bases: BaseNode
Adaptive leaky integrate-and-fire neuron with conductance adaptation.
The ALIF model extends standard LIF by adding a voltage-dependent potassium conductance (g_k) that creates spike-frequency adaptation. Each spike increases g_k by dg_k, which then decays exponentially.
Dynamics
dv/dt = (-g_leak * (v - E_leak) - g_k * (v - E_k) + x) / c_m dg_k/dt = -g_k / tau_adapt
At spike: g_k += dg_k
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 1.0. |
1.0
|
g_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak conductance (nS). Default: 1.0. |
1.0
|
E_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak reversal potential (mV). Default: 0.0. |
0.0
|
E_k
|
float | Float[TensorLike, ' n_neuron']
|
Potassium reversal potential (mV). Default: -70.0. |
-70.0
|
g_k_init
|
float | Float[TensorLike, ' n_neuron']
|
Initial adaptation conductance (nS). Default: 0.0. |
0.0
|
tau_adapt
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation time constant (ms). Default: 20.0. |
20.0
|
dg_k
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation increment per spike (nS). Default: 0.0. |
0.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). None disables refractory. Default: None. |
None
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential, shape (*batch, n_neuron). |
g_k |
Tensor
|
Adaptation conductance, shape (*batch, n_neuron). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref specified). |
c_m, |
(g_leak, E_leak, E_k)
|
Neuron parameters. |
tau_adapt |
Tensor | Parameter
|
Adaptation time constant. |
dg_k |
Tensor | Parameter
|
Per-spike adaptation increment. |
Source code in btorch/models/neurons/alif.py
30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
ELIF
¶
Bases: ALIF
Exponential integrate-and-fire neuron with adaptation.
The ELIF model extends ALIF by adding an exponential term to the voltage dynamics, creating a sharp upswing when approaching threshold (the "initiation zone"). This captures the rapid depolarization seen in real neurons.
Dynamics
dv/dt = (g_leak * delta_T * exp((v - v_T) / delta_T) - g_leak * (v - E_leak) - g_k * (v - E_k) + x) / c_m dg_k/dt = -g_k / tau_adapt
The exponential term creates a soft threshold effect where membrane potential accelerates as it approaches v_T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 1.0. |
1.0
|
g_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak conductance (nS). Default: 1.0. |
1.0
|
E_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak reversal potential (mV). Default: 0.0. |
0.0
|
E_k
|
float | Float[TensorLike, ' n_neuron']
|
Potassium reversal potential (mV). Default: -70.0. |
-70.0
|
g_k_init
|
float | Float[TensorLike, ' n_neuron']
|
Initial adaptation conductance (nS). Default: 0.0. |
0.0
|
tau_adapt
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation time constant (ms). Default: 20.0. |
20.0
|
dg_k
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation increment per spike (nS). Default: 0.0. |
0.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). Default: 0.0. |
0.0
|
delta_T
|
float | Float[TensorLike, ' n_neuron']
|
Slope factor for exponential term (mV). Default: 1.0. |
1.0
|
v_T
|
float | Float[TensorLike, ' n_neuron']
|
Soft threshold potential (mV). Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
delta_T |
Tensor | Parameter
|
Slope factor for exponential term. |
v_T |
Tensor | Parameter
|
Soft threshold potential. |
Source code in btorch/models/neurons/alif.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
GLIF3
¶
Bases: BaseNode
GLIF3 model with after-spike currents and refractory period.
The GLIF3 model extends standard LIF by adding after-spike currents (ASC) that capture spike-frequency adaptation. Each spike adds asc_amps to the ASC vector, which then decays exponentially with time constants 1/k.
Dynamics
dV/dt = -(V - V_rest) / tau + (I_in + sum(I_asc)) / c_m dI_asc/dt = -k * I_asc
At spike: I_asc += asc_amps
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: -50.0. |
-50.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: -70.0. |
-70.0
|
v_rest
|
None | float | Float[TensorLike, ' n_neuron']
|
Resting potential (mV). Defaults to v_reset if None. |
None
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 0.05. |
0.05
|
tau
|
float | Float[TensorLike, ' n_neuron']
|
Membrane time constant (ms). Default: 20.0. |
20.0
|
k
|
float | Sequence[float] | Float[TensorLike, 'n_neuron {self.n_Iasc}']
|
ASC decay rates (ms^-1), can be list for multiple ASC components. Default: [0.2]. |
[0.2]
|
asc_amps
|
float | Sequence[float] | Float[TensorLike, 'n_neuron {self.n_Iasc}']
|
ASC amplitudes (pA) added at each spike. Default: [0.0]. |
[0.0]
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: ATan(). |
ATan()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential, shape (*batch, n_neuron). |
Iasc |
Tensor
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref > 0). |
c_m, |
(tau, tau_ref)
|
Neuron parameters. |
k |
Tensor | Parameter
|
ASC decay rates, shape (n_neuron, n_Iasc) or (n_Iasc,). |
asc_amps |
Tensor | Parameter
|
ASC amplitudes, shape (n_neuron, n_Iasc) or (n_Iasc,). |
n_Iasc |
int
|
Number of ASC components. |
References
Teeter et al., "Generalized leaky integrate-and-fire models classify multiple neuron types," Nature Communications, 2018.
Source code in btorch/models/neurons/glif.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
Attributes¶
v_rest
property
writable
¶
Resting potential (mV).
For compatibility with GLIF4/GLIF5, falls back to v_reset if not explicitly set during initialization.
Returns:
| Type | Description |
|---|---|
Tensor
|
Resting potential tensor. |
Functions¶
dIasc(Iasc)
¶
Compute ASC derivative for exponential Euler integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Iasc
|
Float[Tensor, '*batch n_neuron {self.n_Iasc}']
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple of (derivative, linear_coefficient) for exp_euler_step. |
Source code in btorch/models/neurons/glif.py
dV(v, Iasc, x)
¶
Compute membrane potential derivative for exp Euler integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Float[Tensor, '*batch n_neuron']
|
Membrane potential, shape (*batch, n_neuron). |
required |
Iasc
|
Float[Tensor, '*batch n_neuron {self.n_Iasc}']
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
required |
x
|
Float[Tensor, '*batch n_neuron']
|
Input current, shape (*batch, n_neuron). |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple of (derivative, linear_coefficient) for exp_euler_step. |
Source code in btorch/models/neurons/glif.py
get_rheobase()
¶
Calculate rheobase current, the minimum constant input current required to make the neuron fire.
Izhikevich
¶
Bases: BaseNode
Izhikevich neuron with quadratic dynamics and recovery variable.
Efficient model reproducing diverse spiking patterns (tonic, bursting, etc.) via a 2D ODE system with quadratic nonlinearity.
Dynamics
dv/dt = (k(v-v_rest)(v-v_threshold) - u + I) / c_m du/dt = a * (b*(v-v_rest) - u)
At spike: v=v_reset, u=u+d
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons. |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Threshold (mV). Default: 30.0. |
30.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage (mV). Default: -65.0. |
-65.0
|
v_rest
|
float | Float[TensorLike, ' n_neuron']
|
Resting potential (mV). Default: -65.0. |
-65.0
|
v_peak
|
float | Float[TensorLike, ' n_neuron']
|
Spike cutoff (mV). Default: -40.0. |
-40.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Capacitance (pF). Default: 100.0. |
100.0
|
k
|
float | Float[TensorLike, ' n_neuron']
|
Scaling factor (nS/mV). Default: 0.7. |
0.7
|
a
|
float | Float[TensorLike, ' n_neuron']
|
Recovery timescale (ms^-1). Default: 0.03. |
0.03
|
b
|
float | Float[TensorLike, ' n_neuron']
|
Recovery coupling (nS). Default: -2.0. |
-2.0
|
d
|
float | Float[TensorLike, ' n_neuron']
|
Recovery jump (pA). Default: 100.0. |
100.0
|
trainable_param
|
set[str]
|
Trainable parameters. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike
|
bool
|
Store pre-spike values. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend. Default: "torch". |
'torch'
|
device
|
Device. Default: None. |
None
|
|
dtype
|
Dtype. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential (*batch, n_neuron). |
u |
Tensor
|
Recovery variable (*batch, n_neuron). |
Reference
Izhikevich, IEEE Trans. Neural Networks, 2003.
Source code in btorch/models/neurons/izhikevich.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
Functions¶
from_canonical_quadratic(n_neuron, p1=0.04, p2=5.0, v_rest=-65.0, c_m=1.0, v_peak=30.0, **kwargs)
classmethod
¶
Instantiate using the canonical quadratic form
dV/dt = p1*v^2 + p2*v + p3 - u + I.
The mapping assumes c_m acts as the membrane capacitance and that
k/c_m equals p1. The linear term enforces
v_threshold = -p2/p1 - v_rest. Remaining
keyword arguments are passed directly to :class:Izhikevich.
Source code in btorch/models/neurons/izhikevich.py
from_hippocampome(n_neuron, k, a, b, d, C, vr, vt, vpeak, vmin, **kwargs)
classmethod
¶
Build an :class:Izhikevich neuron using parameter names from
https://hippocampome.org.
Parameter mapping (HippoCampome -> Izhikevich args): - k -> k (scaling factor) - a -> a (recovery time constant) - b -> b (recovery sensitivity) - d -> d (reset current) - C -> c_m (capacitance) - vr -> v_rest (resting potential) - vt -> v_threshold (instantaneous threshold) - vpeak -> v_peak (spike cutoff) - vmin -> v_reset (post-spike reset voltage)
All values are expected in the same units as the canonical Izhikevich model (mV, pF, pA).
Source code in btorch/models/neurons/izhikevich.py
LIF
¶
Bases: BaseNode
Leaky integrate-and-fire neuron with optional refractory period.
The LIF neuron integrates input current while leaking towards a resting potential. When the membrane potential exceeds a threshold, a spike is emitted and the potential is reset.
Dynamics
dV/dt = -(V - V_reset) / tau + I / c_m
If tau_ref is specified, a refractory period prevents spiking for tau_ref milliseconds after each spike.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance. Default: 1.0. |
1.0
|
tau
|
float | Float[TensorLike, ' n_neuron']
|
Membrane time constant (ms). Default: 20.0. |
20.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period duration (ms). None disables refractory behavior. Default: None. |
None
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. Default: empty set. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function for backpropagation. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal from computation graph. Default: False. |
False
|
hard_reset
|
bool
|
If True, reset to v_reset directly. If False, subtract (v_threshold - v_reset) from membrane potential (soft reset). Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage in v_pre_spike buffer. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode, currently only "s" (single step) supported. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential tensor, shape (*batch, n_neuron). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref specified). |
c_m |
Tensor | Parameter
|
Membrane capacitance (parameter or buffer). |
tau |
Tensor | Parameter
|
Time constant (parameter or buffer). |
tau_ref |
Tensor | Parameter | None
|
Refractory period (parameter or buffer, or None). |
Shape
- Input: (*batch, n_neuron)
- Output: (*batch, n_neuron) spike tensor (0 or 1)
Source code in btorch/models/neurons/lif.py
29 30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
btorch.models.neurons.alif
¶
Adaptive leaky integrate-and-fire (ALIF) neuron models.
This module provides ALIF and ELIF (exponential LIF) neuron implementations with conductance-based adaptation mechanisms.
The ALIF neuron extends LIF by adding a potassium conductance (g_k) that increases with each spike, creating spike-frequency adaptation:
dv/dt = (-g_leak * (v - E_leak) - g_k * (v - E_k) + x) / c_m
dg_k/dt = -g_k / tau_adapt
where g_k increments by dg_k at each spike and decays exponentially, creating negative feedback that slows firing rate over time.
Attributes¶
TensorLike = np.ndarray | torch.Tensor
module-attribute
¶
Classes¶
ALIF
¶
Bases: BaseNode
Adaptive leaky integrate-and-fire neuron with conductance adaptation.
The ALIF model extends standard LIF by adding a voltage-dependent potassium conductance (g_k) that creates spike-frequency adaptation. Each spike increases g_k by dg_k, which then decays exponentially.
Dynamics
dv/dt = (-g_leak * (v - E_leak) - g_k * (v - E_k) + x) / c_m dg_k/dt = -g_k / tau_adapt
At spike: g_k += dg_k
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 1.0. |
1.0
|
g_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak conductance (nS). Default: 1.0. |
1.0
|
E_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak reversal potential (mV). Default: 0.0. |
0.0
|
E_k
|
float | Float[TensorLike, ' n_neuron']
|
Potassium reversal potential (mV). Default: -70.0. |
-70.0
|
g_k_init
|
float | Float[TensorLike, ' n_neuron']
|
Initial adaptation conductance (nS). Default: 0.0. |
0.0
|
tau_adapt
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation time constant (ms). Default: 20.0. |
20.0
|
dg_k
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation increment per spike (nS). Default: 0.0. |
0.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). None disables refractory. Default: None. |
None
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential, shape (*batch, n_neuron). |
g_k |
Tensor
|
Adaptation conductance, shape (*batch, n_neuron). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref specified). |
c_m, |
(g_leak, E_leak, E_k)
|
Neuron parameters. |
tau_adapt |
Tensor | Parameter
|
Adaptation time constant. |
dg_k |
Tensor | Parameter
|
Per-spike adaptation increment. |
Source code in btorch/models/neurons/alif.py
30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
BaseNode
¶
Bases: ParamBufferMixin, MemoryModule
Base class for differentiable spiking neurons.
Implements the spiking neuron lifecycle: charge -> adapt -> fire -> reset. Subclasses implement neuronal_charge() and neuronal_adaptation().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold. Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage. Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Trainable parameter names. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike_v
|
bool
|
Store pre-spike voltage. Default: False. |
False
|
step_mode
|
"s" or "m". Default: "s". |
's'
|
|
backend
|
Compute backend. Default: "torch". |
'torch'
|
|
device
|
Tensor device. Default: None. |
None
|
|
dtype
|
Tensor dtype. Default: None. |
None
|
Source code in btorch/models/base.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
Functions¶
__init__(n_neuron, v_threshold=1.0, v_reset=0.0, trainable_param=set(), surrogate_function=Sigmoid(), detach_reset=False, hard_reset=False, pre_spike_v=False, step_mode='s', backend='torch', device=None, dtype=None)
¶
Modified spikingjelly BaseNode.
- :ref:
API in English <BaseNode.__init__-en>
This class is the base class of differentiable spiking neurons.
Source code in btorch/models/base.py
neuronal_charge(x)
abstractmethod
¶
- :ref:
API in English <BaseNode.neuronal_charge-en>
.. _BaseNode.neuronal_charge-cn:
定义神经元的充电差分方程。子类必须实现这个函数。
- :ref:
中文API <BaseNode.neuronal_charge-cn>
.. _BaseNode.neuronal_charge-en:
Define the charge difference equation. The sub-class must implement this function.
Source code in btorch/models/base.py
neuronal_fire()
¶
- :ref:
API in English <BaseNode.neuronal_fire-en>
.. _BaseNode.neuronal_fire-cn:
根据当前神经元的电压、阈值,计算输出脉冲。
- :ref:
中文API <BaseNode.neuronal_fire-cn>
.. _BaseNode.neuronal_fire-en:
Calculate out spikes of neurons by their current membrane potential and threshold voltage.
Source code in btorch/models/base.py
neuronal_reset(spike)
¶
- :ref:
API in English <BaseNode.neuronal_reset-en>
.. _BaseNode.neuronal_reset-cn:
根据当前神经元释放的脉冲,对膜电位进行重置。
- :ref:
中文API <BaseNode.neuronal_reset-cn>
.. _BaseNode.neuronal_reset-en:
Reset the membrane potential according to neurons' output spikes.
Source code in btorch/models/base.py
single_step_forward(x)
¶
- :ref:
API in English <BaseNode.single_step_forward-en>
Source code in btorch/models/base.py
ELIF
¶
Bases: ALIF
Exponential integrate-and-fire neuron with adaptation.
The ELIF model extends ALIF by adding an exponential term to the voltage dynamics, creating a sharp upswing when approaching threshold (the "initiation zone"). This captures the rapid depolarization seen in real neurons.
Dynamics
dv/dt = (g_leak * delta_T * exp((v - v_T) / delta_T) - g_leak * (v - E_leak) - g_k * (v - E_k) + x) / c_m dg_k/dt = -g_k / tau_adapt
The exponential term creates a soft threshold effect where membrane potential accelerates as it approaches v_T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 1.0. |
1.0
|
g_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak conductance (nS). Default: 1.0. |
1.0
|
E_leak
|
float | Float[TensorLike, ' n_neuron']
|
Leak reversal potential (mV). Default: 0.0. |
0.0
|
E_k
|
float | Float[TensorLike, ' n_neuron']
|
Potassium reversal potential (mV). Default: -70.0. |
-70.0
|
g_k_init
|
float | Float[TensorLike, ' n_neuron']
|
Initial adaptation conductance (nS). Default: 0.0. |
0.0
|
tau_adapt
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation time constant (ms). Default: 20.0. |
20.0
|
dg_k
|
float | Float[TensorLike, ' n_neuron']
|
Adaptation increment per spike (nS). Default: 0.0. |
0.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). Default: 0.0. |
0.0
|
delta_T
|
float | Float[TensorLike, ' n_neuron']
|
Slope factor for exponential term (mV). Default: 1.0. |
1.0
|
v_T
|
float | Float[TensorLike, ' n_neuron']
|
Soft threshold potential (mV). Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
delta_T |
Tensor | Parameter
|
Slope factor for exponential term. |
v_T |
Tensor | Parameter
|
Soft threshold potential. |
Source code in btorch/models/neurons/alif.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
Sigmoid
¶
Bases: SurrogateFunctionBase
Logistic surrogate derivative.
Source code in btorch/models/surrogate/sigmoid.py
Functions¶
exp_euler_step(f, *args, dt=1.0, linear=None)
¶
One integration step applying the exponential Euler method.
.. math:: rac{dx}{dt} = f(x) = Ax + B
where :math:A is the linear term and :math:f(x) is the derivative.
The update rule is:
.. math:: x_{n+1} = x_n + rac{e^{dt A} - 1}{A} f(x_n) \ &= e^{dt A}x_n + rac{e^{dt A} - 1}{A} B
Source code in btorch/models/ode.py
btorch.models.neurons.glif
¶
Generalized leaky integrate-and-fire (GLIF) neuron models.
This module implements the GLIF3 model from the Allen Institute [1], which extends standard LIF with after-spike currents (ASC) that capture spike-frequency adaptation and other slow currents.
The GLIF3 neuron follows
dV/dt = -(V - V_rest) / tau + (I_in + sum(I_asc)) / c_m dI_asc/dt = -k * I_asc
where I_asc are after-spike currents that increment by asc_amps at each spike.
References
[1] Teeter et al., "Generalized leaky integrate-and-fire models classify multiple neuron types," Nat. Commun., 2018.
Attributes¶
TensorLike = np.ndarray | torch.Tensor
module-attribute
¶
Classes¶
ATan
¶
Bases: SurrogateFunctionBase
Arctan surrogate matching SpikingJelly's alpha scaling.
Source code in btorch/models/surrogate/atan.py
BaseNode
¶
Bases: ParamBufferMixin, MemoryModule
Base class for differentiable spiking neurons.
Implements the spiking neuron lifecycle: charge -> adapt -> fire -> reset. Subclasses implement neuronal_charge() and neuronal_adaptation().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold. Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage. Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Trainable parameter names. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike_v
|
bool
|
Store pre-spike voltage. Default: False. |
False
|
step_mode
|
"s" or "m". Default: "s". |
's'
|
|
backend
|
Compute backend. Default: "torch". |
'torch'
|
|
device
|
Tensor device. Default: None. |
None
|
|
dtype
|
Tensor dtype. Default: None. |
None
|
Source code in btorch/models/base.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
Functions¶
__init__(n_neuron, v_threshold=1.0, v_reset=0.0, trainable_param=set(), surrogate_function=Sigmoid(), detach_reset=False, hard_reset=False, pre_spike_v=False, step_mode='s', backend='torch', device=None, dtype=None)
¶
Modified spikingjelly BaseNode.
- :ref:
API in English <BaseNode.__init__-en>
This class is the base class of differentiable spiking neurons.
Source code in btorch/models/base.py
neuronal_charge(x)
abstractmethod
¶
- :ref:
API in English <BaseNode.neuronal_charge-en>
.. _BaseNode.neuronal_charge-cn:
定义神经元的充电差分方程。子类必须实现这个函数。
- :ref:
中文API <BaseNode.neuronal_charge-cn>
.. _BaseNode.neuronal_charge-en:
Define the charge difference equation. The sub-class must implement this function.
Source code in btorch/models/base.py
neuronal_fire()
¶
- :ref:
API in English <BaseNode.neuronal_fire-en>
.. _BaseNode.neuronal_fire-cn:
根据当前神经元的电压、阈值,计算输出脉冲。
- :ref:
中文API <BaseNode.neuronal_fire-cn>
.. _BaseNode.neuronal_fire-en:
Calculate out spikes of neurons by their current membrane potential and threshold voltage.
Source code in btorch/models/base.py
neuronal_reset(spike)
¶
- :ref:
API in English <BaseNode.neuronal_reset-en>
.. _BaseNode.neuronal_reset-cn:
根据当前神经元释放的脉冲,对膜电位进行重置。
- :ref:
中文API <BaseNode.neuronal_reset-cn>
.. _BaseNode.neuronal_reset-en:
Reset the membrane potential according to neurons' output spikes.
Source code in btorch/models/base.py
single_step_forward(x)
¶
- :ref:
API in English <BaseNode.single_step_forward-en>
Source code in btorch/models/base.py
GLIF3
¶
Bases: BaseNode
GLIF3 model with after-spike currents and refractory period.
The GLIF3 model extends standard LIF by adding after-spike currents (ASC) that capture spike-frequency adaptation. Each spike adds asc_amps to the ASC vector, which then decays exponentially with time constants 1/k.
Dynamics
dV/dt = -(V - V_rest) / tau + (I_in + sum(I_asc)) / c_m dI_asc/dt = -k * I_asc
At spike: I_asc += asc_amps
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: -50.0. |
-50.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: -70.0. |
-70.0
|
v_rest
|
None | float | Float[TensorLike, ' n_neuron']
|
Resting potential (mV). Defaults to v_reset if None. |
None
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance (pF). Default: 0.05. |
0.05
|
tau
|
float | Float[TensorLike, ' n_neuron']
|
Membrane time constant (ms). Default: 20.0. |
20.0
|
k
|
float | Sequence[float] | Float[TensorLike, 'n_neuron {self.n_Iasc}']
|
ASC decay rates (ms^-1), can be list for multiple ASC components. Default: [0.2]. |
[0.2]
|
asc_amps
|
float | Sequence[float] | Float[TensorLike, 'n_neuron {self.n_Iasc}']
|
ASC amplitudes (pA) added at each spike. Default: [0.0]. |
[0.0]
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period (ms). Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: ATan(). |
ATan()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential, shape (*batch, n_neuron). |
Iasc |
Tensor
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref > 0). |
c_m, |
(tau, tau_ref)
|
Neuron parameters. |
k |
Tensor | Parameter
|
ASC decay rates, shape (n_neuron, n_Iasc) or (n_Iasc,). |
asc_amps |
Tensor | Parameter
|
ASC amplitudes, shape (n_neuron, n_Iasc) or (n_Iasc,). |
n_Iasc |
int
|
Number of ASC components. |
References
Teeter et al., "Generalized leaky integrate-and-fire models classify multiple neuron types," Nature Communications, 2018.
Source code in btorch/models/neurons/glif.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
Attributes¶
v_rest
property
writable
¶
Resting potential (mV).
For compatibility with GLIF4/GLIF5, falls back to v_reset if not explicitly set during initialization.
Returns:
| Type | Description |
|---|---|
Tensor
|
Resting potential tensor. |
Functions¶
dIasc(Iasc)
¶
Compute ASC derivative for exponential Euler integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Iasc
|
Float[Tensor, '*batch n_neuron {self.n_Iasc}']
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple of (derivative, linear_coefficient) for exp_euler_step. |
Source code in btorch/models/neurons/glif.py
dV(v, Iasc, x)
¶
Compute membrane potential derivative for exp Euler integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Float[Tensor, '*batch n_neuron']
|
Membrane potential, shape (*batch, n_neuron). |
required |
Iasc
|
Float[Tensor, '*batch n_neuron {self.n_Iasc}']
|
After-spike currents, shape (*batch, n_neuron, n_Iasc). |
required |
x
|
Float[Tensor, '*batch n_neuron']
|
Input current, shape (*batch, n_neuron). |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple of (derivative, linear_coefficient) for exp_euler_step. |
Source code in btorch/models/neurons/glif.py
get_rheobase()
¶
Calculate rheobase current, the minimum constant input current required to make the neuron fire.
Functions¶
exp_euler_step(f, *args, dt=1.0, linear=None)
¶
One integration step applying the exponential Euler method.
.. math:: rac{dx}{dt} = f(x) = Ax + B
where :math:A is the linear term and :math:f(x) is the derivative.
The update rule is:
.. math:: x_{n+1} = x_n + rac{e^{dt A} - 1}{A} f(x_n) \ &= e^{dt A}x_n + rac{e^{dt A} - 1}{A} B
Source code in btorch/models/ode.py
expand_trailing_dims(tensor, target_trailing_shape, match_full_shape=False, broadcast_only=False, view=True)
¶
Source code in btorch/models/shape.py
get_rheobase(v_threshold, v_rest, c_m, tau)
¶
Calculate rheobase current.
The rheobase is the minimum constant input current required to make the neuron fire. For GLIF models: I_rheobase = (v_threshold - v_rest) * c_m / tau
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_threshold
|
float | Tensor
|
Firing threshold (mV). |
required |
v_rest
|
float | Tensor
|
Resting potential (mV). |
required |
c_m
|
float | Tensor
|
Membrane capacitance (pF). |
required |
tau
|
float | Tensor
|
Membrane time constant (ms). |
required |
Returns:
| Type | Description |
|---|---|
float | Tensor
|
Rheobase current (pA). |
Source code in btorch/models/neurons/glif.py
btorch.models.neurons.izhikevich
¶
Izhikevich neuron model.
Efficient 2D model reproducing diverse cortical spiking patterns.
Attributes¶
TensorLike = np.ndarray | torch.Tensor
module-attribute
¶
Classes¶
BaseNode
¶
Bases: ParamBufferMixin, MemoryModule
Base class for differentiable spiking neurons.
Implements the spiking neuron lifecycle: charge -> adapt -> fire -> reset. Subclasses implement neuronal_charge() and neuronal_adaptation().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold. Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage. Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Trainable parameter names. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike_v
|
bool
|
Store pre-spike voltage. Default: False. |
False
|
step_mode
|
"s" or "m". Default: "s". |
's'
|
|
backend
|
Compute backend. Default: "torch". |
'torch'
|
|
device
|
Tensor device. Default: None. |
None
|
|
dtype
|
Tensor dtype. Default: None. |
None
|
Source code in btorch/models/base.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
Functions¶
__init__(n_neuron, v_threshold=1.0, v_reset=0.0, trainable_param=set(), surrogate_function=Sigmoid(), detach_reset=False, hard_reset=False, pre_spike_v=False, step_mode='s', backend='torch', device=None, dtype=None)
¶
Modified spikingjelly BaseNode.
- :ref:
API in English <BaseNode.__init__-en>
This class is the base class of differentiable spiking neurons.
Source code in btorch/models/base.py
neuronal_charge(x)
abstractmethod
¶
- :ref:
API in English <BaseNode.neuronal_charge-en>
.. _BaseNode.neuronal_charge-cn:
定义神经元的充电差分方程。子类必须实现这个函数。
- :ref:
中文API <BaseNode.neuronal_charge-cn>
.. _BaseNode.neuronal_charge-en:
Define the charge difference equation. The sub-class must implement this function.
Source code in btorch/models/base.py
neuronal_fire()
¶
- :ref:
API in English <BaseNode.neuronal_fire-en>
.. _BaseNode.neuronal_fire-cn:
根据当前神经元的电压、阈值,计算输出脉冲。
- :ref:
中文API <BaseNode.neuronal_fire-cn>
.. _BaseNode.neuronal_fire-en:
Calculate out spikes of neurons by their current membrane potential and threshold voltage.
Source code in btorch/models/base.py
neuronal_reset(spike)
¶
- :ref:
API in English <BaseNode.neuronal_reset-en>
.. _BaseNode.neuronal_reset-cn:
根据当前神经元释放的脉冲,对膜电位进行重置。
- :ref:
中文API <BaseNode.neuronal_reset-cn>
.. _BaseNode.neuronal_reset-en:
Reset the membrane potential according to neurons' output spikes.
Source code in btorch/models/base.py
single_step_forward(x)
¶
- :ref:
API in English <BaseNode.single_step_forward-en>
Source code in btorch/models/base.py
Izhikevich
¶
Bases: BaseNode
Izhikevich neuron with quadratic dynamics and recovery variable.
Efficient model reproducing diverse spiking patterns (tonic, bursting, etc.) via a 2D ODE system with quadratic nonlinearity.
Dynamics
dv/dt = (k(v-v_rest)(v-v_threshold) - u + I) / c_m du/dt = a * (b*(v-v_rest) - u)
At spike: v=v_reset, u=u+d
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons. |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Threshold (mV). Default: 30.0. |
30.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage (mV). Default: -65.0. |
-65.0
|
v_rest
|
float | Float[TensorLike, ' n_neuron']
|
Resting potential (mV). Default: -65.0. |
-65.0
|
v_peak
|
float | Float[TensorLike, ' n_neuron']
|
Spike cutoff (mV). Default: -40.0. |
-40.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Capacitance (pF). Default: 100.0. |
100.0
|
k
|
float | Float[TensorLike, ' n_neuron']
|
Scaling factor (nS/mV). Default: 0.7. |
0.7
|
a
|
float | Float[TensorLike, ' n_neuron']
|
Recovery timescale (ms^-1). Default: 0.03. |
0.03
|
b
|
float | Float[TensorLike, ' n_neuron']
|
Recovery coupling (nS). Default: -2.0. |
-2.0
|
d
|
float | Float[TensorLike, ' n_neuron']
|
Recovery jump (pA). Default: 100.0. |
100.0
|
trainable_param
|
set[str]
|
Trainable parameters. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike
|
bool
|
Store pre-spike values. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend. Default: "torch". |
'torch'
|
device
|
Device. Default: None. |
None
|
|
dtype
|
Dtype. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential (*batch, n_neuron). |
u |
Tensor
|
Recovery variable (*batch, n_neuron). |
Reference
Izhikevich, IEEE Trans. Neural Networks, 2003.
Source code in btorch/models/neurons/izhikevich.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
Functions¶
from_canonical_quadratic(n_neuron, p1=0.04, p2=5.0, v_rest=-65.0, c_m=1.0, v_peak=30.0, **kwargs)
classmethod
¶
Instantiate using the canonical quadratic form
dV/dt = p1*v^2 + p2*v + p3 - u + I.
The mapping assumes c_m acts as the membrane capacitance and that
k/c_m equals p1. The linear term enforces
v_threshold = -p2/p1 - v_rest. Remaining
keyword arguments are passed directly to :class:Izhikevich.
Source code in btorch/models/neurons/izhikevich.py
from_hippocampome(n_neuron, k, a, b, d, C, vr, vt, vpeak, vmin, **kwargs)
classmethod
¶
Build an :class:Izhikevich neuron using parameter names from
https://hippocampome.org.
Parameter mapping (HippoCampome -> Izhikevich args): - k -> k (scaling factor) - a -> a (recovery time constant) - b -> b (recovery sensitivity) - d -> d (reset current) - C -> c_m (capacitance) - vr -> v_rest (resting potential) - vt -> v_threshold (instantaneous threshold) - vpeak -> v_peak (spike cutoff) - vmin -> v_reset (post-spike reset voltage)
All values are expected in the same units as the canonical Izhikevich model (mV, pF, pA).
Source code in btorch/models/neurons/izhikevich.py
Sigmoid
¶
Bases: SurrogateFunctionBase
Logistic surrogate derivative.
Source code in btorch/models/surrogate/sigmoid.py
Functions¶
btorch.models.neurons.lif
¶
Leaky integrate-and-fire (LIF) neuron models.
This module provides LIF and IF (integrate-and-fire) neuron implementations with optional refractory periods. These are the simplest spiking neuron models, suitable for basic neuromorphic computing tasks and as building blocks for more complex networks.
The LIF neuron follows the dynamics
dV/dt = -(V - V_reset) / tau + I / c_m
where V is membrane potential, tau is the time constant, I is input current, and c_m is membrane capacitance.
Attributes¶
TensorLike = np.ndarray | torch.Tensor
module-attribute
¶
Classes¶
BaseNode
¶
Bases: ParamBufferMixin, MemoryModule
Base class for differentiable spiking neurons.
Implements the spiking neuron lifecycle: charge -> adapt -> fire -> reset. Subclasses implement neuronal_charge() and neuronal_adaptation().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold. Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage. Default: 0.0. |
0.0
|
trainable_param
|
set[str]
|
Trainable parameter names. Default: (). |
set()
|
surrogate_function
|
Callable
|
Surrogate for backprop. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
Detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
Hard vs soft reset. Default: False. |
False
|
pre_spike_v
|
bool
|
Store pre-spike voltage. Default: False. |
False
|
step_mode
|
"s" or "m". Default: "s". |
's'
|
|
backend
|
Compute backend. Default: "torch". |
'torch'
|
|
device
|
Tensor device. Default: None. |
None
|
|
dtype
|
Tensor dtype. Default: None. |
None
|
Source code in btorch/models/base.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
Functions¶
__init__(n_neuron, v_threshold=1.0, v_reset=0.0, trainable_param=set(), surrogate_function=Sigmoid(), detach_reset=False, hard_reset=False, pre_spike_v=False, step_mode='s', backend='torch', device=None, dtype=None)
¶
Modified spikingjelly BaseNode.
- :ref:
API in English <BaseNode.__init__-en>
This class is the base class of differentiable spiking neurons.
Source code in btorch/models/base.py
neuronal_charge(x)
abstractmethod
¶
- :ref:
API in English <BaseNode.neuronal_charge-en>
.. _BaseNode.neuronal_charge-cn:
定义神经元的充电差分方程。子类必须实现这个函数。
- :ref:
中文API <BaseNode.neuronal_charge-cn>
.. _BaseNode.neuronal_charge-en:
Define the charge difference equation. The sub-class must implement this function.
Source code in btorch/models/base.py
neuronal_fire()
¶
- :ref:
API in English <BaseNode.neuronal_fire-en>
.. _BaseNode.neuronal_fire-cn:
根据当前神经元的电压、阈值,计算输出脉冲。
- :ref:
中文API <BaseNode.neuronal_fire-cn>
.. _BaseNode.neuronal_fire-en:
Calculate out spikes of neurons by their current membrane potential and threshold voltage.
Source code in btorch/models/base.py
neuronal_reset(spike)
¶
- :ref:
API in English <BaseNode.neuronal_reset-en>
.. _BaseNode.neuronal_reset-cn:
根据当前神经元释放的脉冲,对膜电位进行重置。
- :ref:
中文API <BaseNode.neuronal_reset-cn>
.. _BaseNode.neuronal_reset-en:
Reset the membrane potential according to neurons' output spikes.
Source code in btorch/models/base.py
single_step_forward(x)
¶
- :ref:
API in English <BaseNode.single_step_forward-en>
Source code in btorch/models/base.py
IF
¶
Bases: LIF
Integrate-and-fire neuron without leak.
Simplified variant of LIF that lacks the leak term, meaning the membrane potential integrates input current linearly without decay:
dV/dt = I / c_m
This model is useful for theoretical analysis and as a baseline, though it lacks biological realism due to unbounded integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold. Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike. Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance. Default: 1.0. |
1.0
|
tau
|
float | Float[TensorLike, ' n_neuron']
|
Time constant (inherited from LIF but not used in dynamics). |
20.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period duration. Default: None. |
None
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal. Default: False. |
False
|
hard_reset
|
bool
|
If True, use hard reset. Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Source code in btorch/models/neurons/lif.py
Functions¶
dV(x)
¶
Compute membrane potential derivative (no leak term).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Float[Tensor, '*batch n_neuron']
|
Input current, shape (*batch, n_neuron). |
required |
Returns:
| Type | Description |
|---|---|
Float[Tensor, '*batch n_neuron']
|
dV/dt derivative, shape (*batch, n_neuron). |
Source code in btorch/models/neurons/lif.py
neuronal_charge(x)
¶
Update membrane potential using Euler integration (no leak).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Float[Tensor, '*batch n_neuron']
|
Input current, shape (*batch, n_neuron). |
required |
Source code in btorch/models/neurons/lif.py
LIF
¶
Bases: BaseNode
Leaky integrate-and-fire neuron with optional refractory period.
The LIF neuron integrates input current while leaking towards a resting potential. When the membrane potential exceeds a threshold, a spike is emitted and the potential is reset.
Dynamics
dV/dt = -(V - V_reset) / tau + I / c_m
If tau_ref is specified, a refractory period prevents spiking for tau_ref milliseconds after each spike.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_neuron
|
int | Sequence[int]
|
Number of neurons (int or tuple of dimensions). |
required |
v_threshold
|
float | Float[TensorLike, ' n_neuron']
|
Firing threshold (mV). Default: 1.0. |
1.0
|
v_reset
|
float | Float[TensorLike, ' n_neuron']
|
Reset voltage after spike (mV). Default: 0.0. |
0.0
|
c_m
|
float | Float[TensorLike, ' n_neuron']
|
Membrane capacitance. Default: 1.0. |
1.0
|
tau
|
float | Float[TensorLike, ' n_neuron']
|
Membrane time constant (ms). Default: 20.0. |
20.0
|
tau_ref
|
float | Float[TensorLike, ' n_neuron'] | None
|
Refractory period duration (ms). None disables refractory behavior. Default: None. |
None
|
trainable_param
|
set[str]
|
Set of parameter names to make trainable. Default: empty set. |
set()
|
surrogate_function
|
Callable
|
Surrogate gradient function for backpropagation. Default: Sigmoid(). |
Sigmoid()
|
detach_reset
|
bool
|
If True, detach reset signal from computation graph. Default: False. |
False
|
hard_reset
|
bool
|
If True, reset to v_reset directly. If False, subtract (v_threshold - v_reset) from membrane potential (soft reset). Default: False. |
False
|
pre_spike_v
|
bool
|
If True, store pre-spike voltage in v_pre_spike buffer. Default: False. |
False
|
step_mode
|
Literal['s']
|
Step mode, currently only "s" (single step) supported. Default: "s". |
's'
|
backend
|
Literal['torch']
|
Backend implementation. Default: "torch". |
'torch'
|
device
|
Device for tensors. Default: None. |
None
|
|
dtype
|
Data type for tensors. Default: None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
v |
Tensor
|
Membrane potential tensor, shape (*batch, n_neuron). |
refractory |
Tensor | None
|
Refractory counter (if tau_ref specified). |
c_m |
Tensor | Parameter
|
Membrane capacitance (parameter or buffer). |
tau |
Tensor | Parameter
|
Time constant (parameter or buffer). |
tau_ref |
Tensor | Parameter | None
|
Refractory period (parameter or buffer, or None). |
Shape
- Input: (*batch, n_neuron)
- Output: (*batch, n_neuron) spike tensor (0 or 1)
Source code in btorch/models/neurons/lif.py
29 30 31 32 33 34 35 36 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
Sigmoid
¶
Bases: SurrogateFunctionBase
Logistic surrogate derivative.