AdaptiveThresholdMixin¶
- class AdaptiveThresholdMixin(data: Tensor, batch_reduction: Callable[[Tensor, int | tuple[int, ...]], Tensor] | None = None)[source]¶
Bases:
objectMixin for neurons with adaptative thresholds.
- Parameters:
data (torch.Tensor) – initial threshold 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 threshold_adaptation: Tensor¶
Threshold adaptations.
If the value the setter attempts to assign has the same shape but with an additonal 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: