.MLUtils
RingBuffer
struct
defined in module
MLUtils
RingBuffer(size, buffer)
RingBuffer(buffers)
A
Channel
-like data structure that rotates through
size
buffers. You can either pass in a vector of
buffers
, or a single
buffer
that is copied
size
times.
put!
s work by mutating one of the buffers:
put!(ringbuffer) do buf
rand!(buf)
end
The result can then be
take!
n:
res = take!(ringbuffer)
Only one result is valid at a time! On the next
take!
, the previous result will be reused as a buffer and be mutated by a
put!
There are
2
methods for MLUtils.RingBuffer
:
The following page links back here: