docstr: Sample from replay buffer. All data from replay buffer is
  returned and the buffer is cleared.
  
  Returns:
    Sample of batch_size size.
docstr_tok: ["Sample","from","replay","buffer",".","All","data","from","replay","buffer","is","returned","and","the","buffer","is","cleared",".","Returns",":","Sample","of","batch_size","size","."]
code: def sample(self):
      """Sample from replay buffer. All data from replay buffer is
      returned and the buffer is cleared.
  
      Returns:
        Sample of batch_size size.
      """
      buffer = list(self.buffer)
      self.buffer.clear()
      return buffer
  
file_path: FinRL/finrl/agents/portfolio_optimization/utils.py
imports: from __future__ import annotations
  from collections import deque
  import numpy
  from torch.utils.data.dataset import IterableDataset
label_desc: Use image node_id 4 for calling the ReplayBuffer obj's underlying member method code with example usage: obj.sample() and returns: buffer