use crate::{
error::Result,
models::{Learner, Policy, ValueFunction},
on_policy::losses::FromPolicyValueLosses,
tensor::R2lTensor,
};
pub trait OnPolicyLearner:
Learner<Losses: FromPolicyValueLosses<Self::LearningTensor>>
+ ValueFunction<Tensor = Self::LearningTensor>
{
type InferenceTensor: R2lTensor;
type LearningTensor: R2lTensor;
type InferencePolicy: Policy<Tensor = Self::InferenceTensor> + Clone;
type Policy: Policy<Tensor = Self::LearningTensor>;
fn lifter(t: &Self::InferenceTensor) -> Self::LearningTensor;
fn tensor_from_slice(&self, slice: &[f32]) -> Result<Self::LearningTensor>;
fn inference_policy(&self) -> Self::InferencePolicy;
fn policy(&self) -> &Self::Policy;
fn set_learning_rate(&mut self, learning_rate: f64);
}