MCPcopy Index your code
hub / github.com/OpenDriveLab/TCP / evaluate_actions

Method evaluate_actions

roach/models/ppo_policy.py:120–134  ·  view source on GitHub ↗
(self, obs_dict: Dict[str, th.Tensor], actions: th.Tensor, exploration_suggests,
                         detach_values=False)

Source from the content-addressed store, hash-verified

118 return self.action_dist.proba_distribution(mu, sigma), mu.detach().cpu().numpy(), sigma.detach().cpu().numpy()
119
120 def evaluate_actions(self, obs_dict: Dict[str, th.Tensor], actions: th.Tensor, exploration_suggests,
121 detach_values=False):
122 features = self._get_features(**obs_dict)
123
124 if detach_values:
125 detached_features = features.detach()
126 values = self.value_head(detached_features)
127 else:
128 values = self.value_head(features)
129
130 distribution, mu, sigma = self._get_action_dist_from_features(features)
131 actions = self.scale_action(actions)
132 log_prob = distribution.log_prob(actions)
133 return values.flatten(), log_prob, distribution.entropy_loss(), \
134 distribution.exploration_loss(exploration_suggests), distribution.distribution
135
136 def evaluate_values(self, obs_dict: Dict[str, th.Tensor]):
137 features = self._get_features(**obs_dict)

Callers 1

trainMethod · 0.80

Calls 7

_get_featuresMethod · 0.95
scale_actionMethod · 0.95
flattenMethod · 0.80
log_probMethod · 0.45
entropy_lossMethod · 0.45
exploration_lossMethod · 0.45

Tested by

no test coverage detected