Skip to main content

Observation

Trait Observation 

Source
pub trait Observation<const R: usize>:
    Debug
    + Clone
    + Send
    + Sync
    + Serialize
    + for<'de> Deserialize<'de> {
    const RANK: usize = R;

    // Required method
    fn shape() -> [usize; R];
}
Expand description

The Observation trait defines how an agent perceives the world. It represents something that can be observed from the environment. Implements Serialize and Deserialize for storage in a replay buffer.

Provided Associated Constants§

Source

const RANK: usize = R

The rank of this observation space — i.e. the number of axes (tensor order), not the size of any axis.

“Rank” here means the count of indices needed to address an element (NumPy ndim, Burn’s Tensor<B, R>), not matrix rank or CP-decomposition rank. This is automatically set to match the const generic parameter R.

Required Methods§

Source

fn shape() -> [usize; R]

Returns the size of each axis in this observation space.

The returned array has length R (the rank), where each element is the cardinality of that axis — the number of possible values along it. All values must be greater than zero.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§