AdaptiveCurrentMixin

class AdaptiveCurrentMixin(data: Tensor, batch_reduction: Callable[[Tensor, int | tuple[int, ...]], Tensor] | None = None)[source]

Bases: object

Mixin for neurons with adaptative input currents.

Parameters:

Note

batch_reduction can be one of the functions in PyTorch including but not limited to torch.sum(), torch.mean(), and torch.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:

torch.Tensor