MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

reinforcement_learning/actor_critic.py:54–70  ·  view source on GitHub ↗

forward of both actor and critic

(self, x)

Source from the content-addressed store, hash-verified

52 self.rewards = []
53
54 def forward(self, x):
55 """
56 forward of both actor and critic
57 """
58 x = F.relu(self.affine1(x))
59
60 # actor: choses action to take from state s_t
61 # by returning probability of each action
62 action_prob = F.softmax(self.action_head(x), dim=-1)
63
64 # critic: evaluates being in the state s_t
65 state_values = self.value_head(x)
66
67 # return values for both actor and critic as a tuple of 2 values:
68 # 1. a list with the probability of each action over the action space
69 # 2. the value from state s_t
70 return action_prob, state_values
71
72
73model = Policy()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected