Stateful Layer Updates#
这些函数显式接收并返回 stateful layer 的局部状态,不读取
MemoryModule 的隐式 memory,也不负责 module 生命周期。
These functions receive and return local state for stateful layers explicitly.
They do not read implicit MemoryModule memory and do not manage the module
lifecycle.
- spikingjelly.activation_based.functional.layer.delay_step(x, queue, delay_steps)[源代码]#
-
中文
执行 Delay 的单步显式状态转移。
queue是按时间从旧到新排列的 tensor tuple。 函数返回(y, queue_next),不原地修改输入queue。当delay_steps=0且queue为空时,输出y与输入xalias;当已有 queue 被消费时,输出y与被弹出的 queue 元素 alias。- 参数:
- 返回:
(y, queue_next),其中y是当前输出,queue_next是下一状态- 返回类型:
- 抛出:
ValueError --
delay_steps不是非负整数时抛出
English
Run one explicit Delay state transition.
queueis a tuple of tensors ordered from oldest to newest. The function returns(y, queue_next)and does not mutate the inputqueuein place. Whendelay_steps=0andqueueis empty, outputyaliasesx; when an existing queue item is consumed,yaliases the popped queue item.- 参数:
- 返回:
(y, queue_next), whereyis the current output andqueue_nextis the next state- 返回类型:
- 抛出:
ValueError -- If
delay_stepsis not a non-negative integer
备注
本函数没有独立多步形式;多步执行由调用者逐步循环。 This function has no independent multi-step form; callers iterate it.
- spikingjelly.activation_based.functional.layer.neunorm_step(in_spikes, state, weight, momentum, input_scale)[源代码]#
-
中文
执行一次 NeuNorm 状态转移,返回归一化输出和下一状态。函数不读取或修改 module memory。
- 参数:
- 返回:
(output, state_next)- 返回类型:
English
Run one NeuNorm state transition and return its normalized output and next state. The function does not read or mutate module memory.
- 参数:
in_spikes (Tensor) -- Current input spikes shaped
[N, C, H, W]state (Tensor) -- Materialized NeuNorm state shaped
[N, 1, H, W]weight (Tensor) -- NeuNorm weight broadcastable to
in_spikesmomentum (float) -- Coefficient applied to the previous state
input_scale (float) -- Coefficient applied to the channel sum
- 返回:
(output, state_next)- 返回类型:
备注
本函数没有独立多步形式;多步执行由调用者逐步循环。 This function has no independent multi-step form; callers iterate it.
- spikingjelly.activation_based.functional.layer.synapse_filter_step(x, out_i, reciprocal_tau)[源代码]#
-
中文
执行 SynapseFilter 的单步显式状态转移。函数接收已物化的输出电流状态
out_i和确定的reciprocal_tau = 1 / tau,返回下一时刻输出电流。 该函数不读取或修改MemoryModulememory,也不原地修改x或out_i。- 参数:
- 返回:
下一时刻输出电流
- 返回类型:
English
Run one explicit SynapseFilter state transition. The function receives a materialized output-current state
out_iand the selectedreciprocal_tau = 1 / tau, then returns the next output current. It does not read or mutateMemoryModulememory and does not mutatexorout_iin place.- 参数:
x (Tensor) -- Current input spike or input-current tensor
out_i (Tensor) -- Materialized current output-current tensor state compatible with
xin shape, dtype, and devicereciprocal_tau (float | Tensor) -- Reciprocal time constant; non-learnable modules pass
1 / tauand learnable modules passw.sigmoid()
- 返回:
Next output current
- 返回类型:
备注
本函数没有独立多步形式;多步执行由调用者逐步循环。 This function has no independent multi-step form; callers iterate it.