Class that manages the producers-consumer queue of samples. The queue stores pairs of image and label, pushing and popping them in an exclusive way. The queue also has a maximum size (max_size_
attribute) to avoid memory overflows.
More...
#include <support_eddl.h>
Class that manages the producers-consumer queue of samples. The queue stores pairs of image and label, pushing and popping them in an exclusive way. The queue also has a maximum size (max_size_
attribute) to avoid memory overflows.
Definition at line 143 of file support_eddl.h.
◆ ProducersConsumerQueue() [1/3]
ecvl::ProducersConsumerQueue::ProducersConsumerQueue |
( |
| ) |
|
|
inline |
◆ ProducersConsumerQueue() [2/3]
ecvl::ProducersConsumerQueue::ProducersConsumerQueue |
( |
unsigned |
mxsz | ) |
|
|
inline |
- Parameters
-
[in] | mxsz | Maximum size of the queue. |
Definition at line 157 of file support_eddl.h.
◆ ProducersConsumerQueue() [3/3]
ecvl::ProducersConsumerQueue::ProducersConsumerQueue |
( |
unsigned |
mxsz, |
|
|
unsigned |
thresh |
|
) |
| |
|
inline |
- Parameters
-
[in] | mxsz | Maximum size of the queue. |
[in] | thresh | Threshold from which restart to produce samples. |
Definition at line 162 of file support_eddl.h.
◆ Clear()
void ecvl::ProducersConsumerQueue::Clear |
( |
| ) |
|
|
inline |
◆ IsEmpty()
bool ecvl::ProducersConsumerQueue::IsEmpty |
( |
| ) |
const |
|
inline |
Check if the queue is empty.
- Returns
- true if the queue is empty, false otherwise.
Definition at line 214 of file support_eddl.h.
◆ IsFull()
bool ecvl::ProducersConsumerQueue::IsFull |
( |
| ) |
const |
|
inline |
Check if the queue is full.
- Returns
- true if the queue is full, false otherwise.
Definition at line 204 of file support_eddl.h.
◆ Length()
size_t ecvl::ProducersConsumerQueue::Length |
( |
| ) |
const |
|
inline |
Calculate the current size of the queue.
- Returns
- the current size of the queue.
Definition at line 224 of file support_eddl.h.
◆ Pop()
void ecvl::ProducersConsumerQueue::Pop |
( |
Sample & |
sample, |
|
|
Tensor *& |
image, |
|
|
Tensor *& |
label |
|
) |
| |
|
inline |
Pop a sample from the queue.
Take the lock of the queue and wait if the queue is empty. Otherwise, pop a sample, an image and its label from the queue. If the queue size is still bigger than the half of the maximum size, don't notify the Push to avoid an always-full queue.
- Parameters
-
[in] | sample | Sample to pop from the queue. |
[in] | image | Tensor* of the image to pop from the queue. |
[in] | label | Tensor* of the label to pop from the queue. |
Definition at line 189 of file support_eddl.h.
◆ Push()
void ecvl::ProducersConsumerQueue::Push |
( |
const Sample & |
sample, |
|
|
Tensor *const |
image, |
|
|
Tensor *const |
label |
|
) |
| |
|
inline |
Push a sample in the queue.
Take the lock of the queue and wait if the queue is full. Otherwise, push the tuple sample, image and label into the queue.
- Parameters
-
[in] | sample | Sample to push in queue. |
[in] | image | Tensor* to the image to push in the queue. |
[in] | label | Tensor* to the label to push in the queue. |
Definition at line 172 of file support_eddl.h.
◆ SetSize()
void ecvl::ProducersConsumerQueue::SetSize |
( |
int |
max_size, |
|
|
int |
thresh = -1 |
|
) |
| |
|
inline |
Set the maximum size of the queue and optionally the threshold from which restart to produce samples.
- Parameters
-
[in] | max_size | maximum size of the queue. |
[in] | thresh | threshold from which restart to produce samples. If not specified, it's set to the half of maximum size. |
Definition at line 235 of file support_eddl.h.
The documentation for this class was generated from the following file: