UnfoldTuple
- class hybrid_learning.datasets.transforms.tuple_transforms.UnfoldTuple[source]
Bases:
TransformConvenience trafo that takes an iterable and returns it as tuple. Needed e.g. when unravelling a nested tuple for a composition of
TupleTransforms:>>> from hybrid_learning.datasets.transforms import UnfoldTuple, ToTensor >>> c = UnfoldTuple() + OnTarget(UnfoldTuple() + OnTarget(ToTensor())) >>> nested_tuple = ('desc', ('inp', 1)) >>> nested_tuple ('desc', ('inp', 1)) >>> c(nested_tuple) ('desc', ('inp', tensor(1)))
Public Data Attributes:
Inherited from : py: class:Transform
IDENTITY_CLASSThe identity class or classes for composition / addition.
settingsSettings to reproduce the instance.
Public Methods:
apply_to(tup)Return the given iterable as tuple.
Inherited from : py: class:Transform
apply_to(tup)Return the given iterable as tuple.
Special Methods:
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
selfwithother.__radd__(other)Return a flat composition of
otherandself.__call__(*inps)General call to the transformation.