MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / discount_with_dones

Function discount_with_dones

rl3/a2c/a2c.py:30–36  ·  view source on GitHub ↗
(rewards, dones, gamma)

Source from the content-addressed store, hash-verified

28
29
30def discount_with_dones(rewards, dones, gamma):
31 discounted = []
32 r = 0
33 for reward, done in zip(rewards[::-1], dones[::-1]):
34 r = reward + gamma * r * (1. - done) # fixed off by one bug
35 discounted.append(r)
36 return discounted[::-1]
37
38
39

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected