View Source Rein.Utils.CircularBuffer (rein v0.1.0)
Circular Buffer utility via Nx Containers.
Summary
Functions
Append an item to the current buffer.
Append multiple items to the buffer.
Creates a new Elixir.Rein.Utils.CircularBuffer
with a given shape.
Returns the data starting at the current index.
Functions
Append an item to the current buffer.
If the buffer
data has shape {a, b, c, ...}
,
item
must have shape {b, c, ...}
Append multiple items to the buffer.
Works in a similar fashion to append/2
, but receives
a tensor with shape equal to the buffer data except
for the first axis, which will be the number of items to be appended.
Creates a new Elixir.Rein.Utils.CircularBuffer
with a given shape.
Options
:init_value
- a number or tensor that will be broadcasted toshape
. Defaults to0
. If the value given is vectorized, the buffer will be vectorized accordingly, but all entries will share the same current index and size.:type
- the type for the tensor if:init_value
. Defaults to:f32
Returns the data starting at the current index.
The oldest persisted entry will be the first entry in the result, and so on.