* box.contains check dtype and promote non-ndarrays
Closes: https://github.com/openai/gym/issues/2357 and #2298
Instead of only casting list to ndarray, cast any class to ndarray (if possible) and emit a warning when casting. Also, check if the dtype of the input matches the dtype of the space.
* use import warnings
* blackify
* changs from code review
* fix wrapped space
Co-authored-by: Tristan Deleu <tristandeleu@users.noreply.github.com>
* fix box bondaries
Co-authored-by: Tristan Deleu <tristandeleu@users.noreply.github.com>
* TEST: add regression test.
* STY: black
Co-authored-by: Tristan Deleu <tristandeleu@users.noreply.github.com>
* include low, high, & dtype in spaces.Box.__repr__
multitask learners need a way to make a sensor for each space, and it's possible for two different Box spaces to have the same shape but different low/high/dtype, so this pull request just adds the minimum low value, maximum high value, and the dtype to Box.__repr__ so we can use str(box_space) as a key in a ModuleDict of sensors
* f-string to format
* fix typo
Co-authored-by: Peter Zhokhov <peterz@openai.com>
The current implementation of Box doesn't allow passing an array as low or high while also providing a shape.
The current implementation of Box doesn't allow passing an array as low or high and a constant as the other bound.
Co-authored-by: pzhokhov <peterz@openai.com>
* Force explicit Box dtype
Having the `dtype` argument defaut to `np.float32` without warning can generate some unexpected issues.
For example:
```python
import gym
import numpy as np
num = np.array(3.1415926035897932)
gym.spaces.Box(-num, num).contains(num) # returns False
```
* Warn on lowered precision
* Added support for unbounded box endpoints.
* Documentation and code cleanup.
* Fixed some of the logic of upper bounded versus lower bounded spaces.
* Included unbounded Box instances for the original tests.
* Removed unnecessary attribute in the Box class.
`contains` really should not exist when it does exactly what the builtin
magic method `__contains__` was meant for, but that would break backward
compatibility.
* add dtype to Box
* remove board_game, debugging, safety, parameter_tuning environments
* massive set of breaking changes
- remove python logging module
- _step, _reset, _seed, _close => non underscored method
- remove benchmark and scoring folder
* Improve render("human"), now resizable, closable window.
* get rid of default step and reset in wrappers, so it doesn’t silently fail for people with underscore methods
* CubeCrash unit test environment
* followup fixes
* MemorizeDigits unit test envrionment
* refactored spaces a bit
fixed indentation
disabled test_env_semantics
* fix unit tests
* fixes
* CubeCrash, MemorizeDigits tested
* gym backwards compatibility patch
* gym backwards compatibility, followup fixes
* changelist, add spaces to main namespaces
* undo_logger_setup for backwards compat
* remove configuration.py
* Make environments seedable
* Fix monitor bugs
- Set monitor_id before setting the infix. This was a bug that would yield incorrect results with multiple monitors.
- Remove extra pid from stats recorder filename. This should be purely cosmetic.
* Start uploading seeds in episode_batch
* Fix _bigint_from_bytes for python3
* Set seed explicitly in random_agent
* Pass through seed argument
* Also pass through random state to spaces
* Pass random state into the observation/action spaces
* Make all _seed methods return the list of used seeds
* Switch over to np.random where possible
* Start hashing seeds, and also seed doom engine
* Fixup seeding determinism in many cases
* Seed before loading the ROM
* Make seeding more Python3 friendly
* Make the MuJoCo skipping a bit more forgiving
* Remove debugging PDB calls
* Make setInt argument into raw bytes
* Validate and upload seeds
* Skip box2d
* Make seeds smaller, and change representation of seeds in upload
* Handle long seeds
* Fix RandomAgent example to be deterministic
* Handle integer types correctly in Python2 and Python3
* Try caching pip
* Try adding swap
* Add df and free calls
* Bump swap
* Bump swap size
* Try setting overcommit
* Try other sysctls
* Try fixing overcommit
* Try just setting overcommit_memory=1
* Add explanatory comment
* Add what's new section to readme
* BUG: Mark ElevatorAction-ram-v0 as non-deterministic for now
* Document seed
* Move nondetermistic check into spec