Learing rules

class snngrow.base.learning.STDP.STDP(node: BaseNode, connection: Module, trace_pre: float = 0.0, trace_post: float = 0.0, tau_pre: float = 2.0, tau_post: float = 2.0)

Bases: Module

Parameters:
  • node – BaseNode neuron

  • connection – an instance of a connection layer can have only one operation

  • trace_pre – the trace of a presynaptic neuron

  • trace_post – the trace of a postsynaptic neuron

  • tau_pre – the time constant of the trace of a presynaptic neuron

  • tau_post – the time constant of the trace of a postsynaptic neuron

Type:

torch.nn.Module

Type:

float

Type:

float

Type:

float

Type:

float

STDP learning rule.

cal_trace(in_spike, out_spike)
Parameters:
  • in_spike – input spike

  • out_spike – out spike

  • dw – weight update

Type:

torch.Tensor

Type:

torch.Tensor

Return type:

torch.nn.Module

Calculate weight update and trace.

forward(x)
Parameters:
  • x – input spike

  • spike – output spike

  • dw – weight update

Type:

torch.Tensor

Return type:

torch.Tensor

Return type:

torch.nn.Module

The forward propagation process.

reset()

Reset trace and time constant to default.

training: bool