Package ai.djl.modality.rl
Class LruReplayBuffer
- java.lang.Object
-
- ai.djl.modality.rl.LruReplayBuffer
-
- All Implemented Interfaces:
ReplayBuffer
public class LruReplayBuffer extends java.lang.Object implements ReplayBuffer
A simpleReplayBufferthat randomly selects across the whole buffer, but always removes the oldest items in the buffer once it is full.
-
-
Constructor Summary
Constructors Constructor Description LruReplayBuffer(int batchSize, int bufferSize)Constructs aLruReplayBuffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStep(RlEnv.Step step)Adds a new step to the buffer.RlEnv.Step[]getBatch()Returns a batch of steps from this buffer.
-
-
-
Constructor Detail
-
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 Detail
-
getBatch
public RlEnv.Step[] getBatch()
Returns a batch of steps from this buffer.- Specified by:
getBatchin interfaceReplayBuffer- Returns:
- a batch of steps from this buffer
-
addStep
public void addStep(RlEnv.Step step)
Adds a new step to the buffer.- Specified by:
addStepin interfaceReplayBuffer- Parameters:
step- the step to add
-
-