spikingjelly.clock_driven.examples package

Submodules

spikingjelly.clock_driven.examples.lif_fc_mnist module

spikingjelly.clock_driven.examples.lif_fc_mnist.main()[源代码]
返回

None

使用全连接-LIF-全连接-LIF的网络结构,进行MNIST识别。这个函数会初始化网络进行训练,并显示训练过程中在测试集的正确率。

The network with FC-LIF-FC-LIF structure for classifying MNIST. This function initials the network, starts training and shows accuracy on test dataset.

spikingjelly.clock_driven.examples.conv_fashion_mnist module

class spikingjelly.clock_driven.examples.conv_fashion_mnist.Net(tau, T, v_threshold=1.0, v_reset=0.0)[源代码]

基类:torch.nn.modules.module.Module

forward(x)[源代码]
training: bool
spikingjelly.clock_driven.examples.conv_fashion_mnist.main()[源代码]
返回

None

使用卷积-全连接的网络结构,进行Fashion MNIST识别。这个函数会初始化网络进行训练,并显示训练过程中在测试集的正确率。会将训练过 程中测试集正确率最高的网络保存在 tensorboard 日志文件的同级目录下。这个目录的位置,是在运行 main() 函数时由用户输入的。

训练100个epoch,训练batch和测试集上的正确率如下:

_images/train1.svg _images/test1.svg

The network with Conv-FC structure for classifying Fashion MNIST. This function initials the network, starts training and shows accuracy on test dataset. The net with the max accuracy on test dataset will be saved in the root directory for saving tensorboard logs, which is inputted by user when running the main() function.

After 100 epochs, the accuracy on train batch and test dataset is as followed:

_images/train1.svg _images/test1.svg

spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation module

代码作者: Yanqi Chen <chyq@pku.edu.cn>

A reproduction of the paper Enabling Spike-Based Backpropagation for Training Deep Neural Network Architectures.

This code reproduces a novel gradient-based training method of SNN. We to some extent refer to the network structure and some other detailed implementation in the authors’ implementation. Since the training method and neuron models are slightly different from which in this framework, we rewrite them in a compatible style.

Assuming you have at least 1 Nvidia GPU.

class spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.relu[源代码]

基类:torch.autograd.function.Function

static forward(ctx, x)[源代码]
static backward(ctx, grad_output)[源代码]
class spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.BaseNode(v_threshold=1.0, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>, monitor=False)[源代码]

基类:torch.nn.modules.module.Module

spiking()[源代码]
forward(dv: torch.Tensor)[源代码]
reset()[源代码]
training: bool
class spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.LIFNode(tau=100.0, v_threshold=1.0, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>, fire=True)[源代码]

基类:spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.BaseNode

forward(dv: torch.Tensor)[源代码]
training: bool
class spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.IFNode(v_threshold=0.75, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>)[源代码]

基类:spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.BaseNode

forward(dv: torch.Tensor)[源代码]
training: bool
class spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.ResNet11[源代码]

基类:torch.nn.modules.module.Module

forward(x)[源代码]
reset_()[源代码]
training: bool
spikingjelly.clock_driven.examples.cifar10_r11_enabling_spikebased_backpropagation.main()[源代码]

Module contents