ding.utils.data.structure.lifo_deque¶
ding.utils.data.structure.lifo_deque
¶
LifoDeque
¶
Bases: LifoQueue
Overview
Like LifoQueue, but automatically replaces the oldest data when the queue is full.
Interfaces:
_init, _put, _get
Full Source Code
../ding/utils/data/structure/lifo_deque.py
1from queue import LifoQueue 2from collections import deque 3 4 5class LifoDeque(LifoQueue): 6 """ 7 Overview: 8 Like LifoQueue, but automatically replaces the oldest data when the queue is full. 9 Interfaces: 10 ``_init``, ``_put``, ``_get`` 11 """ 12 13 def _init(self, maxsize): 14 self.maxsize = maxsize + 1 15 self.queue = deque(maxlen=maxsize)