Package ai.djl.modality.rl
Class LruReplayBuffer
java.lang.Object
ai.djl.modality.rl.LruReplayBuffer
- All Implemented Interfaces:
ReplayBuffer
A simple
ReplayBuffer that randomly selects across the whole buffer, but always removes
the oldest items in the buffer once it is full.-
Constructor Summary
ConstructorsConstructorDescriptionLruReplayBuffer(int batchSize, int bufferSize) Constructs aLruReplayBuffer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStep(RlEnv.Step step) Adds a new step to the buffer.getBatch()Returns a batch of steps from this buffer.
-
Constructor Details
-
LruReplayBuffer
public LruReplayBuffer(int batchSize, int bufferSize) Constructs aLruReplayBuffer.- Parameters:
batchSize- the number of steps to train on per batchbufferSize- the number of steps to hold in the buffer
-
-
Method Details
-
getBatch
Returns a batch of steps from this buffer.- Specified by:
getBatchin interfaceReplayBuffer- Returns:
- a batch of steps from this buffer
-
addStep
Adds a new step to the buffer.- Specified by:
addStepin interfaceReplayBuffer- Parameters:
step- the step to add
-