Synapse

class Synapse[source]

Bases: Module, ABC

Base class for representing a group of input synapses for a connection.

abstract clear(**kwargs) None[source]

Resets synapses to their resting state.

Raises:

NotImplementedErrorclear must be implemented by the subclass.

abstract property current: Tensor

Currents of the synapses at present, in nanoamperes.

Parameters:

value (torch.Tensor) – new synapse currents.

Returns:

present synaptic currents.

Return type:

torch.Tensor

Raises:

NotImplementedErrorcurrent must be implemented by the subclass.

abstract current_at(selector: Tensor) Tensor[source]

Currents, in nanoamperes, at times specified by delays, in milliseconds.

Parameters:

selector (torch.Tensor) – delays for selection of currents.

Returns:

synaptic currents at the specified times.

Return type:

torch.Tensor

Raises:

NotImplementedErrorcurrent_at must be implemented by the subclass.

abstract property delay: float

Maximum supported delay, in milliseconds.

Returns:

maximum supported delay.

Return type:

float

abstract property dt: float

Length of the simulation time step, in milliseconds.

Parameters:

value (float) – new simulation time step length.

Returns:

present simulation time step length.

Return type:

float

extra_repr() str[source]

Returns extra information on this module.

abstract forward(*inputs: Tensor, **kwargs) Tensor[source]

Runs a simulation step of the synaptic dynamics.

Parameters:

*inputs (torch.Tensor) – tensors shaped like the synapse.

Returns:

synaptic currents after integration of the inputs.

Return type:

torch.Tensor

Raises:

NotImplementedErrorforward must be implemented by the subclass.

abstract classmethod partialconstructor(*args, **kwargs) SynapseConstructor[source]

Returns a function with a common signature for synapse construction.

Raises:

NotImplementedErrorpartialconstructor must be implemented by the subclass.

Returns:

partial constructor for synapses of a given class.

Return type:

SynapseConstructor

abstract property spike: Tensor

Spike input to the synapses at present.

Parameters:

value (torch.Tensor) – new spike input.

Returns:

present spike input.

Return type:

torch.Tensor

Raises:

NotImplementedErrorspike must be implemented by the subclass.

abstract spike_at(selector: Tensor) Tensor[source]

Spikes, as booleans, at times specified by delays, in milliseconds.

Parameters:

selector (torch.Tensor) – delays for selection of spikes.

Returns:

spike input at the given times.

Return type:

torch.Tensor

Raises:

NotImplementedErrorspike_at must be implemented by the subclass.