ReduceTuple
- class hybrid_learning.datasets.transforms.tuple_transforms.ReduceTuple(trafo, reduction)[source]
Bases:
Transform
Transform an unpacked input tuple and then reduce it to one value using a reduction func. This is essentially the concatenation of two functions, but with type hints assuming a single tensor output, and with better One example would reduction by a loss function.
Note
Attribute access is handed over to
reduction
if the attribute cannot be found in this instance. This is intended to ease wrapping of metric functions.Public Data Attributes:
Settings to reproduce the instance.
Inherited from : py: class:Transform
IDENTITY_CLASS
The identity class or classes for composition / addition.
Settings to reproduce the instance.
Public Methods:
apply_to
(*inps)Apply the transformation and the the reduction.
Inherited from : py: class:Transform
apply_to
(*inps)Apply the transformation and the the reduction.
Special Methods:
__getattr__
(k)Pass attribute requests over to reduction.
__init__
(trafo, reduction)Init.
__radd__
(other)Make it possible to prepend trafos via left addition.
Inherited from : py: class:Transform
__repr__
()Return repr(self).
__eq__
(other)Return self==value.
__copy__
()Return a shallow copy of self using settings.
__add__
(other)Return a flat composition of
self
withother
.__radd__
(other)Make it possible to prepend trafos via left addition.
__call__
(*inps)General call to the transformation.
- __radd__(other)[source]
Make it possible to prepend trafos via left addition.
- Returns
new
ReduceTuple
instance with the new trafo prepended to the old one- Parameters
other (Optional[TupleTransforms]) –
- Return type
- trafo: Callable
The tuple transformation to apply before reducing the tuple.