pub struct EnvironmentSpace { /* private fields */ }Expand description
Checked shape, dtype, and range contract for one environment field.
shape excludes the leading environment-batch dimension. An empty shape
therefore represents one scalar per environment.
Implementations§
Source§impl EnvironmentSpace
impl EnvironmentSpace
Sourcepub fn continuous(
name: impl Into<String>,
shape: impl Into<Vec<usize>>,
dtype: DType,
minimum: f64,
maximum: f64,
) -> Result<Self>
pub fn continuous( name: impl Into<String>, shape: impl Into<Vec<usize>>, dtype: DType, minimum: f64, maximum: f64, ) -> Result<Self>
Construct a floating-point Box space.
§Errors
Returns an error for an empty name, unsupported dtype, zero/overflowing dimensions, NaN bounds, or reversed bounds.
Sourcepub fn discrete(
name: impl Into<String>,
cardinality: usize,
dtype: DType,
) -> Result<Self>
pub fn discrete( name: impl Into<String>, cardinality: usize, dtype: DType, ) -> Result<Self>
Construct a scalar integer category space over [0, cardinality).
§Errors
Returns an error for an empty name, zero cardinality, unsupported dtype, or a cardinality whose inclusive upper bound cannot be represented exactly.
Sourcepub fn binary(
name: impl Into<String>,
shape: impl Into<Vec<usize>>,
) -> Result<Self>
pub fn binary( name: impl Into<String>, shape: impl Into<Vec<usize>>, ) -> Result<Self>
Construct a U8 binary scalar or shaped field.
§Errors
Returns an error for an empty name or zero/overflowing dimensions.
Sourcepub const fn kind(&self) -> EnvironmentSpaceKind
pub const fn kind(&self) -> EnvironmentSpaceKind
Return the structural space kind.
Sourcepub const fn cardinality(&self) -> usize
pub const fn cardinality(&self) -> usize
Return the category count, or zero for a Box space.
Sourcepub fn elements_per_environment(&self) -> usize
pub fn elements_per_environment(&self) -> usize
Return the number of dense values stored per environment.