(self, sess, coord, t_max)
| 145 | self.returns_list = returns_list # Global returns list to plot later |
| 146 | |
| 147 | def run(self, sess, coord, t_max): |
| 148 | with sess.as_default(), sess.graph.as_default(): |
| 149 | # Assign the initial state |
| 150 | self.state = repeat_frame(self.img_transformer.transform(self.env.reset())) |
| 151 | |
| 152 | try: |
| 153 | while not coord.should_stop(): |
| 154 | # Copy weights from global networks to local networks |
| 155 | sess.run(self.copy_params_op) |
| 156 | |
| 157 | # Collect some experience |
| 158 | steps, global_step = self.run_n_steps(t_max, sess) |
| 159 | |
| 160 | # Stop once the max number of global steps has been reached |
| 161 | if self.max_global_steps is not None and global_step >= self.max_global_steps: |
| 162 | coord.request_stop() |
| 163 | return |
| 164 | |
| 165 | # Update the global networks using local gradients |
| 166 | self.update(steps, sess) |
| 167 | |
| 168 | except tf.errors.CancelledError: |
| 169 | return |
| 170 | |
| 171 | def sample_action(self, state, sess): |
| 172 | # Make input N x D (N = 1) |
no test coverage detected