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

Added array-like min and max actions #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beelerchris
Copy link

  1. Added a minimum action variable, included it as the lower bound for action clipping, and modified necessary range calculations.
  2. Changed minimum and maximum action variables to be array-like instead of single floating point variables. torch.clamp doesn't support tensor min and max inputs therefore torch.min and torch.max have to be used instead.

The changes have been tested on Pendulum-v0 and some custom environments with array-like action spaces to ensure clipping and minimum action are handled properly.



def forward(self, state):
a = F.relu(self.l1(state))
a = F.relu(self.l2(a))
return self.max_action * torch.tanh(self.l3(a))
return (self.max_action - self.min_action) * ((torch.tanh(self.l3(a)) + 1) / 2) + self.min_action

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, may I ask the reason why you change here? I have ever tested your code, and comparing with the original one, the performace becomes worse, and the output action results seem very weird.

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

Successfully merging this pull request may close these issues.

2 participants