spikingjelly.event_driven.neuron package
Module contents
- class spikingjelly.event_driven.neuron.Tempotron(in_features, out_features, T, tau=15.0, tau_s=3.75, v_threshold=1.0)[源代码]
基类:
Module
- 参数
in_features – 输入数量,含义与nn.Linear的in_features参数相同
out_features – 输出数量,含义与nn.Linear的out_features参数相同
T – 仿真周期
tau – LIF神经元的积分时间常数
tau_s – 突触上的电流的衰减时间常数
v_threshold – 阈值电压
Gutig R, Sompolinsky H. The tempotron: a neuron that learns spike timing–based decisions[J]. Nature Neuroscience, 2006, 9(3): 420-428. 中提出的Tempotron模型
- static psp_kernel(t: Tensor, tau, tau_s)[源代码]
- 参数
t – 表示时刻的tensor
tau – LIF神经元的积分时间常数
tau_s – 突触上的电流的衰减时间常数
- 返回
t时刻突触后的LIF神经元的电压值
- static mse_loss(v_max, v_threshold, label, num_classes)[源代码]
- 参数
v_max – Tempotron神经元在仿真周期内输出的最大电压值,与forward函数在ret_type == ‘v_max’时的返回值相 同。shape=[batch_size, out_features]的tensor
v_threshold – Tempotron的阈值电压,float或shape=[batch_size, out_features]的tensor
label – 样本的真实标签,shape=[batch_size]的tensor
num_classes – 样本的类别总数,int
- 返回
分类错误的神经元的电压,与阈值电压之差的均方误差
- forward(in_spikes: Tensor, ret_type)[源代码]
- 参数
in_spikes – shape=[batch_size, in_features]
in_spikes[:, i]表示第i个输入脉冲的脉冲发放时刻,介于0到T之间,T是仿真时长
in_spikes[:, i] < 0则表示无脉冲发放 :param ret_type: 返回值的类项,可以为’v’,’v_max’,’spikes’ :return:
ret_type == ‘v’: 返回一个shape=[batch_size, out_features, T]的tensor,表示out_features个Tempotron神经元在仿真时长T 内的电压值
ret_type == ‘v_max’: 返回一个shape=[batch_size, out_features]的tensor,表示out_features个Tempotron神经元在仿真时长T 内的峰值电压
ret_type == ‘spikes’: 返回一个out_spikes,shape=[batch_size, out_features]的tensor,表示out_features个Tempotron神 经元的脉冲发放时刻,out_spikes[:, i]表示第i个输出脉冲的脉冲发放时刻,介于0到T之间,T是仿真时长。out_spikes[:, i] < 0 表示无脉冲发放