TensorDictBase.is_memmap#
- TensorDictBase.is_memmap() bool#
Whether the tensordict is memory-mapped.
Truefor the tensordict ofmemmap_(), and for the results ofmemmap()andmemmap_like()written to a directory or to anonymous memory (not to an archive).A memory-mapped tensordict is locked (see Locking and temporary changes), and unlocking it makes
is_memmapreturnFalse. A tensordict built from memory-mapped tensors, or returned byload_memmap(), is not memory-mapped in this sense: a new entry would not be.Examples
>>> import torch >>> from tensordict import TensorDict >>> td = TensorDict(a=torch.zeros(3)) >>> td.is_memmap(), td.memmap().is_memmap() (False, True)
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.