spikingjelly.activation_based.cuda_kernel.neuron_kernel package#

API Language: 中文 | English


  • 中文

多步神经元CUDA kernel函数接口。

return:

None

rtype:

None


  • English

Multi-step neuron CUDA kernel function interfaces.

return:

None

rtype:

None

spikingjelly.activation_based.cuda_kernel.neuron_kernel.save_cuda_codes(cu_file_path: str = './neuron_kernel_sample.cu')[源代码]#

Save generated CUDA kernel source text for neuron kernels to a .cu file. API Language: 中文 | English


  • 中文

保存CUDA代码到文件

参数:
  • cu_file_path (str) -- 输出的 CUDA 文件路径

  • cu_file_path -- Output CUDA file path

返回:

None

返回类型:

None


  • English

Save CUDA codes to files

参数:

cu_file_path (str) -- Output CUDA file path

返回:

None

返回类型:

None

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_if_ptt(x_seq, v_init, v_threshold, v_reset, detach_reset, surrogate_function)[源代码]#

Multi-step IF neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步IF神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]


  • English

Multi-step IF neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_lif_ptt(x_seq, v_init, decay_input, tau, v_threshold, v_reset, detach_reset, surrogate_function)[源代码]#

Multi-step LIF neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步LIF神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • decay_input (bool) -- Whether input participates in decay

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]


  • English

Multi-step LIF neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • decay_input (bool) -- Whether input participates in decay

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_plif_ptt(x_seq, v_init, reciprocal_tau, decay_input, v_threshold, v_reset, detach_reset, surrogate_function)[源代码]#

Multi-step Parametric LIF neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步PLIF神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • reciprocal_tau (torch.Tensor) -- Reciprocal of the learnable time constant

  • decay_input (bool) -- Whether input participates in decay

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq, reciprocal_tau)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]


  • English

Multi-step PLIF neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • reciprocal_tau (torch.Tensor) -- Reciprocal of the learnable time constant

  • decay_input (bool) -- Whether input participates in decay

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq, reciprocal_tau)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_qif_ptt(x_seq, v_init, tau, v_threshold, v_reset, v_rest, v_c, a0, detach_reset, surrogate_function)[源代码]#

Multi-step QIF neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步QIF神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • v_c (float) -- Cutoff voltage

  • a0 (float) -- Reset value

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]


  • English

Multi-step QIF neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • v_c (float) -- Cutoff voltage

  • a0 (float) -- Reset value

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor]

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_izhikevich_ptt(x_seq, v_init, w_init, tau, v_threshold, v_reset, v_rest, a, b, tau_w, v_c, a0, detach_reset, surrogate_function)[源代码]#

Multi-step Izhikevich neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步Izhikevich神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • w_init (torch.Tensor) -- Initial recovery variable

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • a (float) -- Time scale of the recovery variable

  • b (float) -- Sensitivity of the recovery variable

  • tau_w (float) -- Time constant of the recovery variable

  • v_c (float) -- Cutoff voltage

  • a0 (float) -- Reset value of the recovery variable

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq, w_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]


  • English

Multi-step Izhikevich neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • w_init (torch.Tensor) -- Initial recovery variable

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • a (float) -- Time scale of the recovery variable

  • b (float) -- Sensitivity of the recovery variable

  • tau_w (float) -- Time constant of the recovery variable

  • v_c (float) -- Cutoff voltage

  • a0 (float) -- Reset value of the recovery variable

  • detach_reset (bool) -- Whether to detach the reset term in backward

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_seq, w_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]

spikingjelly.activation_based.cuda_kernel.neuron_kernel.multistep_eif_ptt(x_seq, v_init, tau, v_threshold, v_reset, v_rest, theta_rh, delta_T, detach_reset, surrogate_function)[源代码]#

Multi-step EIF neuron forward pass via CuPy PTT custom op. API Language: 中文 | English


  • 中文

多步EIF神经元脉冲前向传播

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • theta_rh (float) -- Rheobase threshold

  • delta_T (float) -- Slope factor

  • detach_reset (bool) -- Whether to detach the reset term

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_v_seq, h_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]


  • English

Multi-step EIF neuron spike forward

参数:
  • x_seq (torch.Tensor) -- Input sequence, shape [T, N, *]

  • v_init (torch.Tensor) -- Initial membrane potential

  • tau (float) -- Membrane time constant

  • v_threshold (float) -- Threshold voltage

  • v_reset (Optional[float]) -- Reset voltage (None for soft reset)

  • v_rest (float) -- Resting potential

  • theta_rh (float) -- Rheobase threshold

  • delta_T (float) -- Slope factor

  • detach_reset (bool) -- Whether to detach the reset term

  • surrogate_function (surrogate.SurrogateFunctionBase) -- Surrogate gradient function

返回:

Tuple of (spike_seq, v_v_seq, h_seq)

返回类型:

Tuple[torch.Tensor, torch.Tensor, torch.Tensor]