ksuit.data.preprocessors.compose¶
Classes¶
Compose multiple transforms and support inversion by reversing the sequence and inverting each transform. |
Module Contents¶
- class ksuit.data.preprocessors.compose.ComposePreProcess(normalization_key, preprocessors)¶
Compose multiple transforms and support inversion by reversing the sequence and inverting each transform. .. rubric:: Example
>>> normalizer = ComposePreProcess( >>> normalization_key="image", >>> preprocessors=[ >>> MyPreProcessor1(), >>> MyPreProcessor2(), >>> ] >>> ) >>> processed_data = normalizer(input_data) >>> original_data = normalizer.inverse(processed_data)
- Parameters:
normalization_key (str) – key to identify on which getitem_ in the dataset/tensor the preprocessor is applied.
preprocessors (list[ksuit.data.preprocessors.preprocessor.PreProcessor]) – list of PreProcessor instances to compose.
- Raises:
TypeError – If preprocessors is not a list or if any item in the list is not an instance of PreProcessor.
ValueError – If the preprocessors list is empty.
- normalization_key¶
- transforms¶
- inverse(x)¶
Return a transform that applies the inverse transformations in reverse order. :param x: The input to be denormalized.
- Parameters:
x (Any)
- Return type:
Any