Skip to content

Commit

Permalink
add clip back to export (#4713)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcoh authored Dec 7, 2020
1 parent 0aafcee commit 33ae6dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ml-agents/mlagents/trainers/torch/action_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ def get_action_out(self, inputs: torch.Tensor, masks: torch.Tensor) -> torch.Ten
if self.action_spec.continuous_size > 0 and dists.continuous is not None:
continuous_out = dists.continuous.exported_model_output()
action_out_deprecated = dists.continuous.exported_model_output()
if self._clip_action_on_export:
continuous_out = torch.clamp(continuous_out, -3, 3) / 3
action_out_deprecated = torch.clamp(action_out_deprecated, -3, 3) / 3
if self.action_spec.discrete_size > 0 and dists.discrete is not None:
discrete_out_list = [
discrete_dist.exported_model_output()
Expand Down

0 comments on commit 33ae6dc

Please sign in to comment.