tlc.client.utils
#
Module Contents#
Classes#
Class |
Description |
---|---|
Samples elements sequentially from a given list of indices. |
|
Samples elements sequentially from a range |
Functions#
Function |
Description |
---|---|
Ensures that, if the dataset is a Torchvision dataset, its transforms are temporarily removed. |
|
Create a new transforms function which takes the whole sample as its only argument, rather than destructuring it. |
API#
- tlc.client.utils.take(iterator: collections.abc.Iterator, batch_size: int) list #
- tlc.client.utils.batched_iterator(iterator: collections.abc.Iterable, batch_size: int) collections.abc.Iterator[list] #
- class tlc.client.utils.SubsetSequentialSampler(indices: list[int])#
Bases:
torch.utils.data.sampler.Sampler
[int
]Samples elements sequentially from a given list of indices.
- class tlc.client.utils.RangeSampler(end: int, start: int = 0, step: int = 1)#
Bases:
torch.utils.data.sampler.Sampler
[int
]Samples elements sequentially from a range
- tlc.client.utils.without_transforms(dataset: torch.utils.data.Dataset) Generator[Callable | None, None, None] #
Ensures that, if the dataset is a Torchvision dataset, its transforms are temporarily removed.
- Parameters:
dataset – The dataset to temporarily remove transforms from.
- tlc.client.utils.standardized_transforms(transforms: Callable[..., Any]) Callable[[Any], Any] #
Create a new transforms function which takes the whole sample as its only argument, rather than destructuring it.
- Parameters:
transforms – The transforms function to standardize.
- Returns:
The standardized transforms function.