MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / __init__

Method __init__

rl3/a2c/a2c.py:103–117  ·  view source on GitHub ↗
(self, env, agent, nsteps=5, nstack=4, gamma=0.99)

Source from the content-addressed store, hash-verified

101
102class Runner:
103 def __init__(self, env, agent, nsteps=5, nstack=4, gamma=0.99):
104 self.env = env
105 self.agent = agent
106 nh, nw, nc = env.observation_space.shape
107 nenv = env.num_envs
108 self.batch_ob_shape = (nenv * nsteps, nh, nw, nc * nstack)
109 self.state = np.zeros((nenv, nh, nw, nc * nstack), dtype=np.uint8)
110 self.nc = nc
111 obs = env.reset()
112 self.update_state(obs)
113 self.gamma = gamma
114 self.nsteps = nsteps
115 self.dones = [False for _ in range(nenv)]
116 self.total_rewards = [] # store all workers' total rewards
117 self.real_total_rewards = []
118
119 def update_state(self, obs):
120 # Do frame-stacking here instead of the FrameStack wrapper to reduce IPC overhead

Callers

nothing calls this directly

Calls 2

update_stateMethod · 0.95
resetMethod · 0.45

Tested by

no test coverage detected