Trait PolicyLearner
pub trait PolicyLearnerwhere
<Self::InnerPolicy as Policy>::Observation: Clone + Batchable,
<Self::InnerPolicy as Policy>::ActionDistribution: Clone + Batchable,
<Self::InnerPolicy as Policy>::Action: Clone + Batchable,{
type TrainContext;
type InnerPolicy: Policy
where <Self::InnerPolicy as Policy>::Observation: Clone + Batchable,
<Self::InnerPolicy as Policy>::ActionDistribution: Clone + Batchable,
<Self::InnerPolicy as Policy>::Action: Clone + Batchable;
type Record;
// Required methods
fn train(
&mut self,
input: TransitionBatch<<Self::InnerPolicy as Policy>::Observation, <Self::InnerPolicy as Policy>::Action>,
) -> RLTrainOutput<Self::TrainContext, <Self::InnerPolicy as Policy>::PolicyState>;
fn policy(&self) -> Self::InnerPolicy;
fn update_policy(&mut self, update: Self::InnerPolicy);
fn record(&self) -> Self::Record;
fn load_record(self, record: Self::Record) -> Self;
fn device(&self) -> Device;
}Expand description
Learner for a policy.
Required Associated Types§
type TrainContext
type TrainContext
Additional context of a training step.
type InnerPolicy: Policy
where
<Self::InnerPolicy as Policy>::Observation: Clone + Batchable,
<Self::InnerPolicy as Policy>::ActionDistribution: Clone + Batchable,
<Self::InnerPolicy as Policy>::Action: Clone + Batchable
type InnerPolicy: Policy where <Self::InnerPolicy as Policy>::Observation: Clone + Batchable, <Self::InnerPolicy as Policy>::ActionDistribution: Clone + Batchable, <Self::InnerPolicy as Policy>::Action: Clone + Batchable
The policy to train.
type Record
type Record
The record of the learner.
Required Methods§
fn train(
&mut self,
input: TransitionBatch<<Self::InnerPolicy as Policy>::Observation, <Self::InnerPolicy as Policy>::Action>,
) -> RLTrainOutput<Self::TrainContext, <Self::InnerPolicy as Policy>::PolicyState>
fn train( &mut self, input: TransitionBatch<<Self::InnerPolicy as Policy>::Observation, <Self::InnerPolicy as Policy>::Action>, ) -> RLTrainOutput<Self::TrainContext, <Self::InnerPolicy as Policy>::PolicyState>
Execute a training step on the policy.
fn policy(&self) -> Self::InnerPolicy
fn policy(&self) -> Self::InnerPolicy
Returns the learner’s current policy for validation.
fn update_policy(&mut self, update: Self::InnerPolicy)
fn update_policy(&mut self, update: Self::InnerPolicy)
Update the learner’s policy.
fn load_record(self, record: Self::Record) -> Self
fn load_record(self, record: Self::Record) -> Self
Load the learner’s state from a record.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".