diff --git a/docs/guide/custom_env.rst b/docs/guide/custom_env.rst index d769aa5..355ecb2 100644 --- a/docs/guide/custom_env.rst +++ b/docs/guide/custom_env.rst @@ -26,29 +26,29 @@ That is to say, your environment must implement the following methods (and inher from gym import spaces class CustomEnv(gym.Env): - """Custom Environment that follows gym interface""" - metadata = {'render.modes': ['human']} + """Custom Environment that follows gym interface""" + metadata = {'render.modes': ['human']} - def __init__(self, arg1, arg2, ...): - super(CustomEnv, self).__init__() - # Define action and observation space - # They must be gym.spaces objects - # Example when using discrete actions: - self.action_space = spaces.Discrete(N_DISCRETE_ACTIONS) - # Example for using image as input (channel-first; channel-last also works): - self.observation_space = spaces.Box(low=0, high=255, - shape=(N_CHANNELS, HEIGHT, WIDTH), dtype=np.uint8) + def __init__(self, arg1, arg2, ...): + super(CustomEnv, self).__init__() + # Define action and observation space + # They must be gym.spaces objects + # Example when using discrete actions: + self.action_space = spaces.Discrete(N_DISCRETE_ACTIONS) + # Example for using image as input (channel-first; channel-last also works): + self.observation_space = spaces.Box(low=0, high=255, + shape=(N_CHANNELS, HEIGHT, WIDTH), dtype=np.uint8) - def step(self, action): - ... - return observation, reward, done, info - def reset(self): - ... - return observation # reward, done, info can't be included - def render(self, mode='human'): - ... - def close (self): - ... + def step(self, action): + ... + return observation, reward, done, info + def reset(self): + ... + return observation # reward, done, info can't be included + def render(self, mode='human'): + ... + def close (self): + ... Then you can define and train a RL agent with: diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index db6b519..5b084ea 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -39,6 +39,7 @@ Documentation: ^^^^^^^^^^^^^^ - Added doc on Hugging Face integration (@simoninithomas) - 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) @@ -918,4 +919,4 @@ And all the contributors: @benblack769 @bstee615 @c-rizz @skandermoalla @MihaiAnca13 @davidblom603 @ayeright @cyprienc @wkirgsn @AechPro @CUN-bjy @batu @IljaAvadiev @timokau @kachayev @cleversonahum @eleurent @ac-93 @cove9988 @theDebugger811 @hsuehch @Demetrio92 @thomasgubler @IperGiove @ScheiklP -@simoninithomas @armandpl @manuel-delverme +@simoninithomas @armandpl @manuel-delverme @Gautam-J