pub struct ContinuousReplayBatch {
pub observations: Vec<f32>,
pub actions: Vec<f32>,
pub rewards: Vec<f32>,
pub next_observations: Vec<f32>,
pub dones: Vec<bool>,
pub obs_dim: usize,
pub action_dim: usize,
}Expand description
One minibatch sampled from the continuous replay buffer.
All fields are CPU-side primitive vectors; convert to Burn tensors via
ContinuousReplayBatch::to_burn_tensors when handing them to the
trainer.
Fields§
§observations: Vec<f32>Flattened current observations, shape [batch_size * obs_dim].
actions: Vec<f32>Flattened actions taken, shape [batch_size * action_dim].
rewards: Vec<f32>Rewards received, length batch_size.
next_observations: Vec<f32>Flattened next observations, shape [batch_size * obs_dim].
dones: Vec<bool>Episode-end mask, length batch_size. true means the transition
terminated the episode (so the TD target drops the bootstrap term).
obs_dim: usizeLength of one observation slice (so to_burn_tensors can reshape).
action_dim: usizeLength of one action slice (so to_burn_tensors can reshape).
Implementations§
Source§impl ContinuousReplayBatch
impl ContinuousReplayBatch
Sourcepub fn to_burn_tensors<B: Backend>(
&self,
device: &B::Device,
) -> ContinuousReplayBurnTensors<B>
pub fn to_burn_tensors<B: Backend>( &self, device: &B::Device, ) -> ContinuousReplayBurnTensors<B>
Stack the batch into Burn tensors on device.
Returns a named ContinuousReplayBurnTensors struct so trainers can
pattern-match named fields rather than positional tuple elements.
Shapes (all on device):
observations:[batch, obs_dim],f32actions:[batch, action_dim],f32rewards:[batch],f32next_observations:[batch, obs_dim],f32dones:[batch],f32(0.0 / 1.0; the TD-target formula(1 - done)consumes it directly as a float mask).
Trait Implementations§
Source§impl Clone for ContinuousReplayBatch
impl Clone for ContinuousReplayBatch
Source§fn clone(&self) -> ContinuousReplayBatch
fn clone(&self) -> ContinuousReplayBatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ContinuousReplayBatch
impl RefUnwindSafe for ContinuousReplayBatch
impl Send for ContinuousReplayBatch
impl Sync for ContinuousReplayBatch
impl Unpin for ContinuousReplayBatch
impl UnsafeUnpin for ContinuousReplayBatch
impl UnwindSafe for ContinuousReplayBatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more