MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / forward_value

Method forward_value

roach/models/ppo_policy.py:167–173  ·  view source on GitHub ↗
(self, obs_dict: Dict[str, np.ndarray])

Source from the content-addressed store, hash-verified

165 return actions, values, log_prob, mu, sigma, features
166
167 def forward_value(self, obs_dict: Dict[str, np.ndarray]) -> np.ndarray:
168 with th.no_grad():
169 obs_tensor_dict = dict([(k, th.as_tensor(v).to(self.device)) for k, v in obs_dict.items()])
170 features = self._get_features(**obs_tensor_dict)
171 values = self.value_head(features)
172 values = values.cpu().numpy().flatten()
173 return values
174
175 def forward_policy(self, obs_dict: Dict[str, np.ndarray]) -> np.ndarray:
176 with th.no_grad():

Callers 3

update_valuesMethod · 0.80
collect_rolloutsMethod · 0.80
trainMethod · 0.80

Calls 2

_get_featuresMethod · 0.95
flattenMethod · 0.80

Tested by

no test coverage detected