Skip to main content

LibVecEnv

Struct LibVecEnv 

Source
pub struct LibVecEnv { /* private fields */ }
Expand description

Vector environments of a Library, with the operations of CompiledVecEnv.

Implementations§

Source§

impl LibVecEnv

Source

pub fn name(&self) -> &str

The environment’s name.

Source

pub fn num_actions(&self) -> usize

The number of discrete actions (0 for continuous actions).

Source

pub fn obs_shape(&self) -> &[usize]

The shape of one observation.

Source

pub fn action_space(&self) -> &ActionSpace

The actions.

Source

pub fn num_envs(&self) -> usize

The number of environments.

Source

pub fn num_threads(&self) -> usize

The number of threads that step the environments.

Source

pub fn set_num_threads(&mut self, threads: usize)

Changes the number of threads.

Source

pub fn reset(&mut self, seed: Option<i64>)

Starts new episodes (see CompiledVecEnv::reset).

Source

pub fn obs_into(&self, out: &mut [f32])

Writes the observations.

§Panics

Panics if out does not hold num_envs * obs_len floats.

Source

pub fn step_into(&mut self, actions: Actions<'_>, out: StepBuffers<'_>)

Steps every environment (see CompiledVecEnv::step_into_actions).

§Panics

Panics if a buffer has the wrong length.

Source

pub fn step_into_without_final( &mut self, actions: Actions<'_>, obs: &mut [f32], reward: &mut [f32], terminated: &mut [bool], truncated: &mut [bool], )

Steps every environment without the final observations (see CompiledVecEnv::step_into_without_final).

§Panics

Panics if the number or kind of actions is wrong, or a buffer has the wrong length.

Source

pub fn legal_action_masks_into(&self, out: &mut [bool]) -> bool

Writes the legal action masks and returns true, or returns false if the environment has none.

§Panics

Panics if out does not hold num_envs masks over the joint actions.

Trait Implementations§

Source§

impl Debug for LibVecEnv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for LibVecEnv

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for LibVecEnv

Source§

impl Sync for LibVecEnv

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.