Hello, why does the network perform the largest selected action (action) instead of randomly sampled actions (action_). According to the policy_grad algorithm, the actions performed by the network are randomly sampled, but the network executes in your program It is the maximum action, but the probability is stored at random, and your program says that action and action_ are the same value, but during the debugging process, I found that it’s not the same value. Something may happen when action is 2. action_ is 7 or other, can you answer it?
if args.cuda:
action = np.argmax(fc6_out.detach().cpu().numpy()) # TODO: really okay to detach?
action_prob = fc6_out.detach().cpu().numpy()[0][action]
else:
action = np.argmax(fc6_out.detach().numpy()) # TODO: really okay to detach?
action_prob = fc6_out.detach().numpy()[0][action]
m = Categorical(probs=fc6_out)
action_ = m.sample() # action and action_ are same value. Only differ in the type (int and tensor)
self.log_probs_list.append(m.log_prob(action_).cpu().data.numpy())
self.vid_idx_list.append(vid_idx)
self.action_list.append(action)
# TODO: saving action_prob_list takes cuda memory
# self.action_prob_list.append(action_prob)
new_state, reward, done, info = self.env.step(action)
Hello, why does the network perform the largest selected action (action) instead of randomly sampled actions (action_). According to the policy_grad algorithm, the actions performed by the network are randomly sampled, but the network executes in your program It is the maximum action, but the probability is stored at random, and your program says that action and action_ are the same value, but during the debugging process, I found that it’s not the same value. Something may happen when action is 2. action_ is 7 or other, can you answer it?
if args.cuda:
action = np.argmax(fc6_out.detach().cpu().numpy()) # TODO: really okay to detach?
action_prob = fc6_out.detach().cpu().numpy()[0][action]
else:
action = np.argmax(fc6_out.detach().numpy()) # TODO: really okay to detach?
action_prob = fc6_out.detach().numpy()[0][action]