Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAC Bugs #25

Open
ZiyiLiubird opened this issue Jan 24, 2021 · 4 comments
Open

SAC Bugs #25

ZiyiLiubird opened this issue Jan 24, 2021 · 4 comments

Comments

@ZiyiLiubird
Copy link

In SAC.py, SAC_BipedalWalker-v2.py, the codes:

class NormalizedActions(gym.ActionWrapper):
    def _action(self, action):
        low = self.action_space.low
        high = self.action_space.high

        action = low + (action + 1.0) * 0.5 * (high - low)
        action = np.clip(action, low, high)

        return action

    def _reverse_action(self, action):
        low = self.action_space.low
        high = self.action_space.high

        action = 2 * (action - low) / (high - low) - 1
        action = np.clip(action, low, high)

        return action

now should be changed as follows:

class NormalizedActions(gym.ActionWrapper):
    def action(self, action):
        low = self.action_space.low
        high = self.action_space.high

        action = low + (action + 1.0) * 0.5 * (high - low)
        action = np.clip(action, low, high)

        return action

    def reverse_action(self, action):
        low = self.action_space.low
        high = self.action_space.high

        action = 2 * (action - low) / (high - low) - 1
        action = np.clip(action, low, high)

        return action

in order to adapt to the latest OpenAI Gym core.py

@ZiyiLiubird
Copy link
Author

ZiyiLiubird commented Jan 24, 2021

otherwise there will be an overloaded error that "
Traceback (most recent call last):
File "SAC.py", line 308, in
main()
File "SAC.py", line 288, in main
next_state, reward, done, info = env.step(np.float64(action))
File "/Users/Shared/anaconda3/envs/Pytorch/lib/python3.8/site-packages/gym/core.py", line 285, in step
return self.env.step(self.action(action))
File "/Users/Shared/anaconda3/envs/Pytorch/lib/python3.8/site-packages/gym/core.py", line 288, in action
raise NotImplementedError
NotImplementedError
"

@hshhsjsj
Copy link

you are amazing,

@zhaoyanghandd
Copy link

RuntimeError: Found dtype Double but expected Float 请问该如何解决呢

@SMALLFISH-hub
Copy link

RuntimeError: Found dtype Double but expected Float 请问该如何解决呢

请问你解决了吗,我也遇到了相同的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants