pub trait Sampler {
type Tensor: R2lTensor;
// Required methods
fn collect_rollouts<A: Actor<Tensor = Self::Tensor> + Clone>(
&mut self,
actor: A,
) -> Result<(), Error>;
fn trajectory_views(
&mut self,
) -> impl AsRef<[TrajectoryView<'_, Self::Tensor>]>;
// Provided method
fn reset_all_envs(&mut self) -> Result<(), Error> { ... }
}Expand description
Rollout collector used by an on-policy training loop.
Required Associated Types§
Required Methods§
Sourcefn collect_rollouts<A: Actor<Tensor = Self::Tensor> + Clone>(
&mut self,
actor: A,
) -> Result<(), Error>
fn collect_rollouts<A: Actor<Tensor = Self::Tensor> + Clone>( &mut self, actor: A, ) -> Result<(), Error>
Collects rollout data using the provided actor.
§Errors
Returns an error if an environment operation fails during collection.
Sourcefn trajectory_views(&mut self) -> impl AsRef<[TrajectoryView<'_, Self::Tensor>]>
fn trajectory_views(&mut self) -> impl AsRef<[TrajectoryView<'_, Self::Tensor>]>
Creates a view for the agents.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".