TensorDictBase.load_memmap#
- TensorDictBase.load_memmap_(prefix: str | Path, robust_key: bool | None = True, *, allow_pickle: bool | None = None, mode: str | None = None)#
Loads the content of a memory-mapped tensordict within the tensordict where
load_memmap_is called.The tensordict and its nested containers are reused, but the leaves are rebound to the loaded tensors, so their storage is not reused. Keys that are missing from the saved data are removed. To write the data into the existing storage, use
td.update_(TensorDict.load_memmap(prefix, device=td.device))instead.- Parameters:
- Keyword Arguments:
allow_pickle (bool, optional) – whether pickled non-tensor fields may be loaded. Pickle can execute arbitrary code, so pass
Trueonly for data from a trusted source andFalsefor untrusted data. As inload_memmap(), omitting this option loads pickle with aFutureWarningin 0.14 and 0.15, and the default changes toFalsein 0.16.mode (str, optional) – the mode of the memory maps. See
load_memmap().
See
load_memmap()for more info.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.