Skip to content

Added array-like min and max actions#29

Open
beelerchris wants to merge 1 commit into
sfujim:masterfrom
beelerchris:master
Open

Added array-like min and max actions#29
beelerchris wants to merge 1 commit into
sfujim:masterfrom
beelerchris:master

Conversation

@beelerchris

Copy link
Copy Markdown
  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.

Comment thread TD3.py
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

Copy link
Copy Markdown

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