浏览代码

Merge branch 'develop-actions-out' into develop-hybrid-actions

/develop/actionmodel-csharp
Andrew Cohen 4 年前
当前提交
9cbf6c3f
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 6
      ml-agents/mlagents/trainers/torch/distributions.py
  2. 2
      ml-agents/mlagents/trainers/torch/networks.py

6
ml-agents/mlagents/trainers/torch/distributions.py


pass
@abc.abstractmethod
def action_out(self) -> torch.Tensor:
def exported_model_output(self) -> torch.Tensor:
"""
Returns the tensor to be exported to ONNX for the distribution
"""

def entropy(self):
return 0.5 * torch.log(2 * math.pi * math.e * self.std + EPSILON)
def action_out(self):
def exported_model_output(self):
return self.sample()

def entropy(self):
return -torch.sum(self.probs * torch.log(self.probs), dim=-1)
def action_out(self):
def exported_model_output(self):
return self.all_log_prob()

2
ml-agents/mlagents/trainers/torch/networks.py


"""
# TODO: This is bad right now
dists, _ = self.get_dists(vec_inputs, vis_inputs, masks, memories, 1)
action_out = torch.cat([dist.action_out() for dist in dists], dim=1)
action_out = torch.cat([dist.exported_model_output() for dist in dists], dim=1)
return (
action_out,
self.version_number,

正在加载...
取消
保存