Shortcuts

LazyTensorStorage

class torchrl.data.replay_buffers.LazyTensorStorage(*args, **kwargs)[source]

A pre-allocated tensor storage for tensors and tensordicts.

Parameters:
  • size (int) – size of the storage, i.e. maximum number of elements stored in the buffer.

  • device (torch.device, optional) – device where the sampled tensors will be stored and sent. Default is torch.device("cpu").

attach(buffer: Any) None

This function attaches a sampler to this storage.

Buffers that read from this storage must be included as an attached entity by calling this method. This guarantees that when data in the storage changes, components are made aware of changes even if the storage is shared with other buffers (eg. Priority Samplers).

Parameters:

buffer – the object that reads from this storage.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources