示例#1
0
 def testBasic(self):
     ray.init(num_cpus=4)
     local = _MockEvaluator()
     remotes = ray.remote(_MockEvaluator)
     remote_evaluators = [remotes.remote() for i in range(5)]
     test_optimizer = AsyncGradientsOptimizer(local, remote_evaluators,
                                              {"grads_per_step": 10})
     test_optimizer.step()
     self.assertTrue(all(local.get_weights() == 0))
示例#2
0
 def testBasic(self):
     ray.init(num_cpus=4)
     local = _MockEvaluator()
     remotes = ray.remote(_MockEvaluator)
     remote_evaluators = [remotes.remote() for i in range(5)]
     test_optimizer = AsyncOptimizer(
         {"grads_per_step": 10}, local, remote_evaluators)
     test_optimizer.step()
     self.assertTrue(all(local.get_weights() == 0))