hxtorch.spiking.transforms.weight_transforms

Define convenient software <-> hardware weight mappings

Functions

hxtorch.spiking.transforms.weight_transforms.linear_saturating(weight: torch.Tensor, scale: float = 1.0, min_weight: float = - 63.0, max_weight: float = 63.0)torch.Tensor

Scale all weights according to:

w <- clip(scale * w, min_weight, max_weight)

TODO: Maybe make this function member of HXSynapse and allow different

weight transformations by inheritance.

Parameters
  • weight – The weight tensor to be transformed.

  • scale – A constant the weight tensor is scaled with.

  • min_weight – The minimum value, smaller values are clipped to after scaling.

  • max_weight – The maximum value, bigger values are clipped to after scaling.

Returns

The transformed weight tensor.