Compose¶
- class torchtime.transforms.Compose(transforms: List[Callable])[source]¶
Composes several transforms together. This transform does not support torchscript. Please, see the note below.
- Parameters:
transforms (list of
Transform
objects) – list of transforms to compose.
Example
>>> transforms.Compose([ >>> transforms.Nan2Value(), >>> transforms.ToTensor(), >>> ])
Note
In order to script the transformations, please use
torch.nn.Sequential
as below.>>> transforms = torch.nn.Sequential( >>> transforms.Nan2Value(), >>> transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)), >>> ) >>> scripted_transforms = torch.jit.script(transforms)
Make sure to use only scriptable transformations, i.e. that work with
torch.Tensor
, does not require lambda functions,numpy
orpandas
.