AdaptiveCurrentMixin¶
- class AdaptiveCurrentMixin(data: Tensor, batch_reduction: Callable[[Tensor, int | tuple[int, ...]], Tensor] | None = None)[source]¶
Bases:
objectMixin for neurons with adaptative input currents.
- Parameters:
data (torch.Tensor) – initial input adaptations.
batch_reduction (Callable[[torch.Tensor, tuple[int, ...]], torch.Tensor] | None) – function to reduce adaptation updates over the batch dimension,
torch.mean()whenNone. Defaults toNone.
Note
batch_reductioncan be one of the functions in PyTorch including but not limited totorch.sum(),torch.mean(), andtorch.amax(). A custom function with similar behavior can also be passed in. Like with the included function, it should not keep the original dimensions by default.- property current_adaptation: Tensor¶
Input current adaptations.
If the value the setter attempts to assign has the same shape but with an additional leading dimension, it will assume that is an unreduced batch dimension and reduce it.
- Parameters:
value (torch.Tensor) – new threshold adaptations.
- Returns:
present threshold adaptations.
- Return type: