PyTriton
model_navigator.api.utilities
Public utilities for the Model Navigator API.
UnpackedDataloader(dataloader, unpack_fn)
A wrapper around a SizedDataLoader that applies a function to each sample.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataloader |
SizedDataLoader
|
A SizedDataLoader. |
required |
unpack_fn |
Callable
|
A function that takes a sample and returns a new sample. |
required |
Returns:
Type | Description |
---|---|
An iterator over the samples in the dataloader with the unpack_fn applied. |
Example
dataloader = [1, 2, 3] unpacked_dataloader = UnpackedDataloader(dataloader, lambda x: x + 1)
unpacked_dataloader is now [2, 3, 4]
Initialize the UnpackedDataloader.
Source code in model_navigator/api/utilities.py
__iter__()
Return an iterator over the samples in the dataloader with the unpack_fn applied.