MCPcopy Create free account
hub / github.com/pytorch/tutorials / _loss_actor

Function _loss_actor

advanced_source/coding_ddpg.py:287–298  ·  view source on GitHub ↗
(
    self,
    tensordict,
)

Source from the content-addressed store, hash-verified

285
286
287def _loss_actor(
288 self,
289 tensordict,
290) -> torch.Tensor:
291 td_copy = tensordict.select(*self.actor_in_keys)
292 # Get an action from the actor network: since we made it functional, we need to pass the params
293 with self.actor_network_params.to_module(self.actor_network):
294 td_copy = self.actor_network(td_copy)
295 # get the value associated with that action
296 with self.value_network_params.detach().to_module(self.value_network):
297 td_copy = self.value_network(td_copy)
298 return -td_copy.get("state_action_value")
299
300
301###############################################################################

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected