torchsig.utils.file_handlers.base_handler.FileWriter¶
- class torchsig.utils.file_handlers.base_handler.FileWriter(root: str, **kwargs)[source]¶
Bases:
objectBase class for writing datasets to disk.
- root¶
Location on disk to write dataset.
- Type:
Methods
Check if the dataset directory already exists.
Prepare resources before writing begins.
Hook for cleaning up resources after writing is complete.
Write a single batch to disk.
- __init__(root: str, **kwargs)[source]¶
Initializes the FileWriter.
- Parameters:
root (str) – Location on disk to write dataset.
- setup() None[source]¶
Prepare resources before writing begins.
This resets the root folder and then calls the subclass _setup.
- write(batch_idx: int, data: Any) None[source]¶
Write a single batch to disk.
- Parameters:
batch_idx (int) – Index of the batch being written.
data (Any) – Data to be written.
- Raises:
NotImplementedError – Must be implemented in subclasses.