hxtorch.spiking.transforms.encode.CoordinatesToSpikes
-
class
hxtorch.spiking.transforms.encode.
CoordinatesToSpikes
(seq_length: int, t_early: float, t_late: float, dt: float = 1e-06, t_bias: Optional[float] = None) Bases:
torch.nn.modules.module.Module
Convert values between 0 and 1 to spikes in a given timeframe
-
__init__
(seq_length: int, t_early: float, t_late: float, dt: float = 1e-06, t_bias: Optional[float] = None) → None Construct a coordinates-to-spikes converter. This converter takes coordinate values in [0, 1] and maps them to spike times in interval [t_early, t_late]. A spike is indicated by a 1 on a dense time axis of length seq_length with temporal resolution dt. Further, it adds a bias spike at time t_bias, if t_bias is not None.
- Parameters
seq_length – Number of time steps in the resulting time sequence. The effective time length is given by seq_length * dt.
t_early – The earliest time a spike will occur.
t_late – The latest time a spike will occur.
dt – The temporal resolution.
t_bias – The time a bias spike occurs.
Methods
__init__
(seq_length, t_early, t_late[, dt, …])Construct a coordinates-to-spikes converter.
forward
(coordinate_values)Convert coordinate values of to dense spike tensor of zeros and ones.
Attributes
-
forward
(coordinate_values: torch.Tensor) → torch.Tensor Convert coordinate values of to dense spike tensor of zeros and ones.
- Parameters
coordinate_values – Tensor with values in [0, 1], shaped (batch_size, num_channels)
- Returns
Returns a dense tensor of shape (batch_size, seq_length, num_channels)
-
training
: bool
-