| 119 | self.logstd = AddBias(torch.zeros(num_outputs)) |
| 120 | |
| 121 | def forward(self, x): |
| 122 | action_mean = self.fc_mean(x) |
| 123 | action_mean = torch.tanh(action_mean) |
| 124 | # An ugly hack for my KFAC implementation. |
| 125 | zeros = torch.zeros(action_mean.size()) |
| 126 | if x.is_cuda: |
| 127 | zeros = zeros.to(self.device) |
| 128 | |
| 129 | action_logstd = self.logstd(zeros) |
| 130 | action_logstd = torch.tanh(action_logstd) |
| 131 | # print('action log std in uav_collection charge2:',action_logstd) |
| 132 | # print('mean', action_mean, 'std', action_logstd) |
| 133 | # TODO: Fixed Normal input(mean, standard deviation) |
| 134 | return FixedNormal(action_mean, action_logstd.exp().sqrt()) |