Skip to content
Snippets Groups Projects
Commit ee052e16 authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

add some documentation for transforms

parent 85930b5e
No related branches found
No related tags found
No related merge requests found
......@@ -5,13 +5,26 @@ from torch import Tensor
class Transform:
"""
Interface of a transformer. A transformer can be initialized and then applied to
an input tensor and expected output tensor as returned by a dataset. It can be
used for normalization and data augmentation.
"""
def __call__(
self, inputs: Tensor, outputs_expected: Tensor
) -> Tuple[Tensor, Tensor]:
"""
Apply the transformer to a pair of inputs and expected outputs in a dataset.
"""
return inputs, outputs_expected
class SequenceTransform(Transform):
"""
A transformer that applies a sequence of transformers sequentially.
"""
def __init__(self, transforms: List[Transform]):
self.transforms = transforms
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment