hxtorch.spiking.functional.mock.bounds

Define dataclass that holds data needed to mock bounds (e.g. bounds of the dynamic ranges of membrane- and adaptation voltage or the CADC readout bounds)

Classes

Bounds(lower, torch.Tensor]] =, upper, …)

Class defining bounds of a finite value range and how to deal with the bounds in simulation. :param lower: The lower bound. :param upper: The upper bound. :param device: The device, the tensors containing the bounds are transfered to. :param hardware_aware: When set to True, the saturation effect is considered in the backward pass of the simulation; Else, the backward function is set to be the identity function and torch.clamp() is used instead of a surrogate. :param surrogate: Callable that implements a surrogate function for the clamp function. Is needed in case of of a hardware aware backpropagation.

InitVar(type)

partial

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

Functions

hxtorch.spiking.functional.mock.bounds.dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)

Add dunder methods based on the fields defined in the class.

Examines PEP 526 __annotations__ to determine fields.

If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comparison dunder methods are added. If unsafe_hash is true, a __hash__() method is added. If frozen is true, fields may not be assigned to after instance creation. If match_args is true, the __match_args__ tuple is added. If kw_only is true, then by default all fields are keyword-only. If slots is true, a new class with a __slots__ attribute is returned.

hxtorch.spiking.functional.mock.bounds.exponential_rolloff(input: torch.Tensor, lower: torch.Tensor, upper: torch.Tensor, rolloff_margin: float = 0.03, rolloff_margin_abs: float = 0.05)torch.Tensor

Wrapper for ExponentialRolloff.apply()

hxtorch.spiking.functional.mock.bounds.field(*, default=<dataclasses._MISSING_TYPE object>, default_factory=<dataclasses._MISSING_TYPE object>, init=True, repr=True, hash=None, compare=True, metadata=None, kw_only=<dataclasses._MISSING_TYPE object>)

Return an object to identify dataclass fields.

default is the default value of the field. default_factory is a 0-argument function called to initialize a field’s value. If init is true, the field will be a parameter to the class’s __init__() function. If repr is true, the field will be included in the object’s repr(). If hash is true, the field will be included in the object’s hash(). If compare is true, the field will be used in comparison functions. metadata, if specified, must be a mapping which is stored but not otherwise examined by dataclass. If kw_only is true, the field will become a keyword-only parameter to __init__().

It is an error to specify both default and default_factory.