mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-18 09:54:10 +00:00
update docs fix indentation (#764)
* update docs fix indentation Changed code block indentation from 2 spaces to 4 spaces for consistency. * update changelog * Update changelog.rst Co-authored-by: Anssi <kaneran21@hotmail.com>
This commit is contained in:
parent
40bda9a918
commit
59bec30180
2 changed files with 23 additions and 22 deletions
|
|
@ -26,29 +26,29 @@ That is to say, your environment must implement the following methods (and inher
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
|
|
||||||
class CustomEnv(gym.Env):
|
class CustomEnv(gym.Env):
|
||||||
"""Custom Environment that follows gym interface"""
|
"""Custom Environment that follows gym interface"""
|
||||||
metadata = {'render.modes': ['human']}
|
metadata = {'render.modes': ['human']}
|
||||||
|
|
||||||
def __init__(self, arg1, arg2, ...):
|
def __init__(self, arg1, arg2, ...):
|
||||||
super(CustomEnv, self).__init__()
|
super(CustomEnv, self).__init__()
|
||||||
# Define action and observation space
|
# Define action and observation space
|
||||||
# They must be gym.spaces objects
|
# They must be gym.spaces objects
|
||||||
# Example when using discrete actions:
|
# Example when using discrete actions:
|
||||||
self.action_space = spaces.Discrete(N_DISCRETE_ACTIONS)
|
self.action_space = spaces.Discrete(N_DISCRETE_ACTIONS)
|
||||||
# Example for using image as input (channel-first; channel-last also works):
|
# Example for using image as input (channel-first; channel-last also works):
|
||||||
self.observation_space = spaces.Box(low=0, high=255,
|
self.observation_space = spaces.Box(low=0, high=255,
|
||||||
shape=(N_CHANNELS, HEIGHT, WIDTH), dtype=np.uint8)
|
shape=(N_CHANNELS, HEIGHT, WIDTH), dtype=np.uint8)
|
||||||
|
|
||||||
def step(self, action):
|
def step(self, action):
|
||||||
...
|
...
|
||||||
return observation, reward, done, info
|
return observation, reward, done, info
|
||||||
def reset(self):
|
def reset(self):
|
||||||
...
|
...
|
||||||
return observation # reward, done, info can't be included
|
return observation # reward, done, info can't be included
|
||||||
def render(self, mode='human'):
|
def render(self, mode='human'):
|
||||||
...
|
...
|
||||||
def close (self):
|
def close (self):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
Then you can define and train a RL agent with:
|
Then you can define and train a RL agent with:
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ Documentation:
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
- Added doc on Hugging Face integration (@simoninithomas)
|
- Added doc on Hugging Face integration (@simoninithomas)
|
||||||
- Added furuta pendulum project to project list (@armandpl)
|
- Added furuta pendulum project to project list (@armandpl)
|
||||||
|
- Fix indentation 2 spaces to 4 spaces in custom env documentation example (@Gautam-J)
|
||||||
|
|
||||||
|
|
||||||
Release 1.4.0 (2022-01-18)
|
Release 1.4.0 (2022-01-18)
|
||||||
|
|
@ -918,4 +919,4 @@ And all the contributors:
|
||||||
@benblack769 @bstee615 @c-rizz @skandermoalla @MihaiAnca13 @davidblom603 @ayeright @cyprienc
|
@benblack769 @bstee615 @c-rizz @skandermoalla @MihaiAnca13 @davidblom603 @ayeright @cyprienc
|
||||||
@wkirgsn @AechPro @CUN-bjy @batu @IljaAvadiev @timokau @kachayev @cleversonahum
|
@wkirgsn @AechPro @CUN-bjy @batu @IljaAvadiev @timokau @kachayev @cleversonahum
|
||||||
@eleurent @ac-93 @cove9988 @theDebugger811 @hsuehch @Demetrio92 @thomasgubler @IperGiove @ScheiklP
|
@eleurent @ac-93 @cove9988 @theDebugger811 @hsuehch @Demetrio92 @thomasgubler @IperGiove @ScheiklP
|
||||||
@simoninithomas @armandpl @manuel-delverme
|
@simoninithomas @armandpl @manuel-delverme @Gautam-J
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue