spikingjelly.activation_based.functional package#
警告
卷积-批归一化融合函数已弃用。用户可以使用 PyTorch的fuse_conv_bn_eval 来实现相同的功能。
Functions for conv-bn fusion have been deprecated. Use PyTorch's fuse_conv_bn_eval to achieve the same functionality.
备注
API稳定性说明
SpikingJelly 0.0.0.1.0 对 functional 模块的内部实现进行了重构:原来的 functional.py 文件已被拆分并重组为 functional/ 包,以提升代码的模块化程度和可维护性。
该改动不会影响对外公开的 API。 我们强烈建议用户仍然通过 functional 这一顶层命名空间来访问相关功能,而不是从具体的内部子模块中进行导入。 functional 层级下的导入路径被视为稳定的公共接口;更深层的子模块仅作为内部实现细节,未来可能发生变化。
from spikingjelly.activation_based.functional import reset_net # 推荐 ✅
from spikingjelly.activation_based.functional.net_config import reset_net # 不推荐 ❌
API Stability Notice
We have refactored the internal implementation of the functional module. The original functional.py file has been reorganized into a package ( functional/ ) for better modularity and maintainability.
This change does not affect the public API. Users are strongly encouraged to continue accessing layers directly from the functional namespace, rather than importing from specific internal submodules. Import paths under functional are considered part of the stable public API, while deeper submodule paths are treated as implementation details and may change in future releases.
from spikingjelly.activation_based.functional import reset_net # recommended ✅
from spikingjelly.activation_based.functional.net_config import reset_net # not recommended ❌
Network Configuration Functions#
这些函数帮助用户统一设置网络中每个 子模块的配置 ,如步进模式、后端等。
These functions help users set configurations for each submodule in a network, such as step mode and backend.
Reset the state of a network. |
|
Set the step mode for a network. |
|
Set the computational backend for a network. |
|
Detach the network's parameters from the computation graph. |
Forward Functions#
SpikingJelly 的 前向传播函数 实现了 SNN 的多步前向传播逻辑。
SpikingJelly's forward functions provide multi-step forward propagation logic for SNNs.
Forward pass for stateful modules in multi-step mode. |
|
Multi-step forward. The time dimension is placed at the last. |
|
Multi-step forward pass with chunked processing. |
|
Forward pass for stateless modules in multi-step mode. |
|
Seq-to-ann forward. The time dimension is placed at the last. |
Loss Functions#
适用于 SNN 的 损失函数 实现。
Loss functions suitable for SNNs.
Kernel dot product implementation. |
|
Spike similarity loss. |
|
TET loss. |
Online Learning Pipelines#
在线学习 的辅助函数。
Auxiliary functions for online learning .
Initialize weight for FPTT. |
|
Online training with FPTT. |
|
Online training with OTTT or SLTT. |
Miscellaneous#
其他辅助 工具函数 。
Other auxiliary tool functions .
Set the threshold margin for classification layers. |
|
Convert labels to redundant one-hot encoding. |
|
Find the index of the first spike in a spike train. |
|
Initialize weights with Kaiming Normal initialization. |
|
|