renate.memory.storage module#
- renate.memory.storage.mmap_tensor(filename, size, dtype)[source]#
Creates or accesses a memory-mapped tensor.
- Return type:
Tensor
- class renate.memory.storage.Storage(directory)[source]#
Bases:
DatasetAn abstract class for permanent storage of datasets.
- class renate.memory.storage.MemoryMappedTensorStorage(directory)[source]#
Bases:
StorageA class implementing permanent storage of nested tensor datasets.
This implements storage for
lengthdata points consisting of nested tensors of fixed types and shapes.Storageimplements__len__and__getitem__and therefore can be used as a torchDataset. To populate the storage, it also implementsdump_dataset. It does _not_ keep track which slots have or have not been populated.Storageis given a path to a directory, where it creates (or accesses, if they already exist) memory-mapped tensor files.- Parameters:
- class renate.memory.storage.FileTensorStorage(directory)[source]#
Bases:
StorageA class implementing permanent storage of nested tensor datasets to disk as pickle files.
This implements storage for
lengthdata points consisting of nested tensors of fixed types and shapes.Storageimplements__len__and__getitem__and therefore can be used as a torchDataset. To populate the storage, it also implementsdump_dataset. It does _not_ keep track which slots have or have not been populated.Storageis given a path to a directory, where it creates (or accesses, if they already exist) pickle files one for each point in the dataset.- Parameters:
directory¶ (
str) – Path to a directory.