Online Learning Modules#
SpikingJelly 的 在线学习模块 提供了用于在线学习的辅助类和操作。
SpikingJelly's online learning modules provide auxiliary classes and operations for online learning.
- class spikingjelly.activation_based.layer.online_learning.ReplaceforGrad(*args, **kwargs)[源代码]#
基类:
Function
中文
在 OTTT 在线训练中用于替换前向值与梯度路径的自定义自动求导函数。 前向返回
x_r,反向时梯度同时传播给x和x_r。
English
Custom autograd Function for replacing forward values and gradient paths in OTTT online training. Forward returns
x_r, backward passes gradients to bothxandx_r.
- class spikingjelly.activation_based.layer.online_learning.GradwithTrace(module)[源代码]#
基类:
Module
中文
用于随时间在线训练时,根据神经元的迹计算梯度 出处:'Online Training Through Time for Spiking Neural Networks <https://openreview.net/forum?id=Siv3nHYHheI>'
- 参数:
module (Module) -- 需要包装的模块
English
Used for online training through time, calculate gradients by the traces of neurons Reference: 'Online Training Through Time for Spiking Neural Networks <https://openreview.net/forum?id=Siv3nHYHheI>'
- 参数:
module (Module) -- the module that requires wrapping
- class spikingjelly.activation_based.layer.online_learning.SpikeTraceOp(module)[源代码]#
基类:
Module
中文
对脉冲和迹进行相同的运算,如Dropout,AvgPool等
- 参数:
module (Module) -- 需要包装的模块
English
perform the same operations for spike and trace, such as Dropout, Avgpool, etc.
- 参数:
module (Module) -- the module that requires wrapping
- class spikingjelly.activation_based.layer.online_learning.OTTTSequential(*args)[源代码]#
基类:
Sequential
中文
用于 OTTT(Online Training Through Time)的顺序容器,扩展自
nn.Sequential。 在forward中,若输入为[spike, trace]列表形式,则自动将有参数的模块包装为GradwithTrace, 将无参数的模块包装为SpikeTraceOp,以实现在线训练中的梯度传递。- 参数:
args (nn.Module) -- 需要顺序执行的模块
English
Sequential container for OTTT (Online Training Through Time), extending
nn.Sequential. Duringforward, if the input is a[spike, trace]list, modules with parameters are automatically wrapped byGradwithTrace, while parameter-free modules are wrapped bySpikeTraceOp, enabling gradient propagation for online training.- 参数:
args (nn.Module) -- Modules to be executed sequentially