GPU Batch Worker for reanalyzing targets, see Appendix. receive the context from CPU maker and deal with GPU overheads Parameters ---------- worker_id: int id of the worker replay_buffer: Any Replay buffer storage: Any
(self, worker_id, replay_buffer, storage, batch_storage, mcts_storage, config)
| 266 | @ray.remote(num_gpus=0.125) |
| 267 | class BatchWorker_GPU(object): |
| 268 | def __init__(self, worker_id, replay_buffer, storage, batch_storage, mcts_storage, config): |
| 269 | """GPU Batch Worker for reanalyzing targets, see Appendix. |
| 270 | receive the context from CPU maker and deal with GPU overheads |
| 271 | Parameters |
| 272 | ---------- |
| 273 | worker_id: int |
| 274 | id of the worker |
| 275 | replay_buffer: Any |
| 276 | Replay buffer |
| 277 | storage: Any |
| 278 | The model storage |
| 279 | batch_storage: Any |
| 280 | The batch storage (batch queue) |
| 281 | mcts_storage: Ant |
| 282 | The mcts-related contexts storage |
| 283 | """ |
| 284 | self.replay_buffer = replay_buffer |
| 285 | self.config = config |
| 286 | self.worker_id = worker_id |
| 287 | |
| 288 | self.model = config.get_uniform_network() |
| 289 | self.model.to(config.device) |
| 290 | self.model.eval() |
| 291 | |
| 292 | self.mcts_storage = mcts_storage |
| 293 | self.storage = storage |
| 294 | self.batch_storage = batch_storage |
| 295 | |
| 296 | self.last_model_index = 0 |
| 297 | |
| 298 | def _prepare_reward_value(self, reward_value_context): |
| 299 | """prepare reward and value targets from the context of rewards and values |
nothing calls this directly
no test coverage detected