5 releases
0.0.8 | May 17, 2025 |
---|---|
0.0.7 | Sep 1, 2024 |
0.0.6 | Sep 19, 2023 |
0.0.5 | Jan 25, 2022 |
0.0.4 | Jul 18, 2021 |
#1614 in Machine learning
138 downloads per month
Used in border-derive
210KB
3K
SLoC
A wrapper of Gymnasium environments on Python.
GymEnv
is a wrapper of Gymnasium based on PyO3
.
It has been tested on some of classic control and
Gymnasium-Robotics environments.
In order to bridge Python and Rust, we need to convert Python objects to Rust objects and vice versa.
This crate provides the GymEnvConverter
trait to handle these conversions.
Type Conversion
The GymEnvConverter
trait provides a unified interface for converting between Python and Rust types:
filt_obs
: Converts Python observations to Rust typesfilt_act
: Converts Rust actions to Python types
Implementations
This crate provides several implementations of GymEnvConverter
:
ndarray::NdarrayConverter
: Handles conversions for environments using ndarray typescandle::CandleConverter
: Handles conversions for environments using Candle tensor types (requirescandle
feature flag)tch::TchConverter
: Handles conversions for environments using Tch tensor types (requirestch
feature flag)
To use Candle or Tch converters, enable the corresponding feature in your Cargo.toml
:
[dependencies]
border-py-gym-env = { version = "0.1.0", features = ["candle"] } # For Candle support
# or
border-py-gym-env = { version = "0.1.0", features = ["tch"] } # For Tch support
Each implementation supports different types of observations and actions:
- Array observations (e.g., CartPole)
- Dictionary observations (e.g., FetchPickAndPlace)
- Discrete actions (e.g., CartPole)
- Continuous actions (e.g., Pendulum)
Dependencies
~13–27MB
~343K SLoC