tlc.client.utils
¶
Module Contents¶
Classes¶
Class |
Description |
---|---|
Samples elements sequentially from a given list of indices. |
|
Samples elements sequentially from a range |
|
Repeats elements based on their weight. |
|
A callable class that wraps transforms to take the whole sample as its only argument, rather than destructuring it. |
Functions¶
Function |
Description |
---|---|
Ensures that, if the dataset is a Torchvision dataset, its transforms are temporarily removed. |
|
Relativize the given URL with respect to the given owner URL, up to a maximum depth. |
|
Create a new transforms function which takes the whole sample as its only argument, rather than destructuring it. |
|
Return a the specified column of the table as a pyarrow table. |
API¶
- class SubsetSequentialSampler( )¶
Bases:
torch.utils.data.sampler.Sampler
[int
]Samples elements sequentially from a given list of indices.
- class RangeSampler( )¶
Bases:
torch.utils.data.sampler.Sampler
[int
]Samples elements sequentially from a range
- class RepeatByWeightSampler( )¶
Bases:
torch.utils.data.sampler.Sampler
[int
]Repeats elements based on their weight.
- without_transforms(
- dataset: Dataset,
Ensures that, if the dataset is a Torchvision dataset, its transforms are temporarily removed.
- Parameters:
dataset – The dataset to temporarily remove transforms from.
- relativize_with_max_depth( ) Url ¶
Relativize the given URL with respect to the given owner URL, up to a maximum depth.
Deprecated: Use
Url.to_relative_with_max_depth
instead.
- class StandardizedTransforms( )¶
A callable class that wraps transforms to take the whole sample as its only argument, rather than destructuring it.
- standardized_transforms( ) 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.
- get_column_from_pyarrow_table( ) Array | ChunkedArray ¶
Return a the specified column of the table as a pyarrow table.
To get nested sub-columns, use dot notation. E.g. ‘column.sub_column’. The values in the column will be the row-view of the table. A column which is a PIL image in its sample-view, for instance, will be returned as a column of strings.
- Parameters:
name – The name of the column to get.
combine_chunks – Whether to combine the chunks of the returned column in the case that it is a ChunkedArray. Defaults to True.
- Returns:
A pyarrow array containing the specified column.
- Raises:
KeyError – If the column does not exist in the table.