Skip to content

Commit

Permalink
update a little
Browse files Browse the repository at this point in the history
  • Loading branch information
icoxfog417 committed Nov 18, 2018
1 parent 331663b commit be7148d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion FN/a2c_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ def set_updater(self, optimizer,

_, action_evals, values = self.model.output

advantages = rewards - values
neg_logs = tf.nn.sparse_softmax_cross_entropy_with_logits(
logits=action_evals, labels=actions)
advantages = rewards - values

policy_loss = tf.reduce_mean(neg_logs * tf.nn.softplus(advantages))

batch_indices = tf.range(tf.shape(actions)[0])
action_indices = tf.stack([batch_indices, actions], axis=1)
value_only = rewards - tf.gather_nd(action_evals, action_indices)
Expand Down
2 changes: 1 addition & 1 deletion IM/dagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def imitate(self, env, teacher, initial_step=100, train_step=200,
states = []
actions = []

# Collect teacher's demonstration.
# Collect teacher's demonstrations.
for e in range(initial_step):
s = env.reset()
done = False
Expand Down

0 comments on commit be7148d

Please sign in to comment.