hxtorch.spiking.Synapse
-
class
hxtorch.spiking.Synapse(in_features: int, out_features: int, experiment: Experiment, chip_coordinate: Optional[Tuple[grenade.common.ChipOnConnection, grenade.common.ConnectionOnExecutor]] = None, device: str = None, dtype: Type = None, plasticity_rule: PlasticityRule | None = None, receptor: Literal['excitatory', 'inhibitory'] | List[str] | Tuple[str, ...] | None = None, weight_scale: float = 1.0, mock: bool = False, weight_step: Union[torch.Tensor, float, int, None] = 1.0, weight_bounds: Optional[Bounds] = Bounds(_lower=tensor(-63.), _upper=tensor(63.), device=None, hardware_aware=True, surrogate=functools.partial(<function exponential_rolloff>, rolloff_margin=0.1, rolloff_margin_abs=0.15)), event_drop_transform: Optional[Callable] = None) Bases:
hxtorch.spiking.modules.types.projection.ProjectionSynapse layer
Caveat: For execution on hardware, this module can only be used in conjunction with a subsequent Neuron module.
-
__init__(in_features: int, out_features: int, experiment: Experiment, chip_coordinate: Optional[Tuple[grenade.common.ChipOnConnection, grenade.common.ConnectionOnExecutor]] = None, device: str = None, dtype: Type = None, plasticity_rule: PlasticityRule | None = None, receptor: Literal['excitatory', 'inhibitory'] | List[str] | Tuple[str, ...] | None = None, weight_scale: float = 1.0, mock: bool = False, weight_step: Union[torch.Tensor, float, int, None] = 1.0, weight_bounds: Optional[Bounds] = Bounds(_lower=tensor(-63.), _upper=tensor(63.), device=None, hardware_aware=True, surrogate=functools.partial(<function exponential_rolloff>, rolloff_margin=0.1, rolloff_margin_abs=0.15)), event_drop_transform: Optional[Callable] = None) → None TODO: Think about what to do with device here.
- Parameters
in_features – Size of input dimension.
out_features – Size of output dimension.
experiment – Experiment to append layer to.
chip_coordinate – Chip coordinate this module is placed on.
device – Device to execute on. Only considered in mock-mode.
dtype – Data type of weight tensor.
plasticity_rule – Plasticity rule adjusting this synapse.
weight_scale – Scaling factor, with which the weight values are multiplied to transform them from model to hardware domain.
mock – Flag that enables the mocking of discrete and finite weights in simulation, similar as on hardware.
weight_step – The step size for the discretization, which is to be performed on the weights. The weight values are rounded to the closest multiple of weight_step. If set to None, no weight discretization is performed.
weight_bounds – The bounds, to which the values in the weight Tensor are clamped to if they exceed the bounds. Also holds the surrogate function which is used as a replacement for the clamp function. If weight_bounds is set to None, no clamping is performed.
event_drop_transform – A function to mock pre-synaptic event drops. Needs to take a torch.Tensor of shape (timesteps, batch size, pre-synaptic population size) that includes the spike events recieved by the synapse layer and return a torch.Tensor of the same shape.
- Param
receptor: Receptor type of the synapse. Can be ‘excitatory’, ‘inhibitory’ or (‘excitatory’, inhibitory’) for a signed synapse.
Methods
__init__(in_features, out_features, experiment)TODO: Think about what to do with device here.
forward_func(input)Resets the synapses weights by reinitialization using torch.nn.kaiming_uniform_.
Attributes
Getter for changed_since_last_run.
-
property
changed_input_data Getter for changed_since_last_run.
- Returns
Boolean indicating wether module changed since last run.
-
forward_func(input: hxtorch.spiking.handle.Handle_current_membrane_cadc_membrane_madc_spikes) → hxtorch.spiking.handle.Handle_graded_spikes
-
get_connections() → List[Tuple[int, int, float]]
-
output_type
-
reset_parameters() → None Resets the synapses weights by reinitialization using torch.nn.kaiming_uniform_.
-