trw.transforms.transforms

Module Contents

Classes

Transform

Abstraction of a batch transform

TransformBatchWithCriteria

Helper function to apply a given transform function on features that satisfy a criteria

Functions

criteria_is_array_n_or_above(batch: trw.basic_typing.Batch, dim: int) → Sequence[str]

Return True if the feature is a numpy or torch array dim >= dim

criteria_is_array_4_or_above(batch: trw.basic_typing.Batch) → Sequence[str]

Return list of feature names which is a numpy or torch array dim >= 4, typically all

criteria_feature_name(batch: trw.basic_typing.Batch, feature_names: Sequence[str]) → Sequence[str]

Return list of feature names which belong to a given set of names

criteria_is_tensor(batch: trw.basic_typing.Batch) → Sequence[str]

Return list of feature names which is torch.Tensor

Attributes

CriteriaFn

class trw.transforms.transforms.Transform

Abstraction of a batch transform

abstract __call__(self, batch: trw.basic_typing.Batch) trw.basic_typing.Batch
trw.transforms.transforms.CriteriaFn
class trw.transforms.transforms.TransformBatchWithCriteria(criteria_fn: CriteriaFn, transform_fn: Callable[[Sequence[str], trw.basic_typing.Batch], trw.basic_typing.Batch])

Bases: Transform

Helper function to apply a given transform function on features that satisfy a criteria

__call__(self, batch: trw.basic_typing.Batch) trw.basic_typing.Batch
trw.transforms.transforms.criteria_is_array_n_or_above(batch: trw.basic_typing.Batch, dim: int) Sequence[str]

Return True if the feature is a numpy or torch array dim >= dim

trw.transforms.transforms.criteria_is_array_4_or_above(batch: trw.basic_typing.Batch) Sequence[str]

Return list of feature names which is a numpy or torch array dim >= 4, typically all n-d images, n >= 2

trw.transforms.transforms.criteria_feature_name(batch: trw.basic_typing.Batch, feature_names: Sequence[str]) Sequence[str]

Return list of feature names which belong to a given set of names

trw.transforms.transforms.criteria_is_tensor(batch: trw.basic_typing.Batch) Sequence[str]

Return list of feature names which is torch.Tensor