mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 23:25:54 +08:00
[tune] Add test_sample to bazel BUILD (#10566)
This commit is contained in:
@@ -147,6 +147,14 @@ py_test(
|
||||
tags = ["exclusive"],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "test_sample",
|
||||
size = "medium",
|
||||
srcs = ["tests/test_sample.py"],
|
||||
deps = [":tune_lib"],
|
||||
tags = ["exclusive"],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "test_sync",
|
||||
size = "medium",
|
||||
|
||||
@@ -304,12 +304,10 @@ class SearchSpaceTest(unittest.TestCase):
|
||||
]
|
||||
|
||||
sampler1 = RandomSampler(seed=1234)
|
||||
searcher1 = OptunaSearch(
|
||||
space=converted_config, sampler=sampler1, base_config=config)
|
||||
searcher1 = OptunaSearch(space=converted_config, sampler=sampler1)
|
||||
|
||||
sampler2 = RandomSampler(seed=1234)
|
||||
searcher2 = OptunaSearch(
|
||||
space=optuna_config, sampler=sampler2, base_config=config)
|
||||
searcher2 = OptunaSearch(space=optuna_config, sampler=sampler2)
|
||||
|
||||
config1 = searcher1.suggest("0")
|
||||
config2 = searcher2.suggest("0")
|
||||
@@ -317,7 +315,6 @@ class SearchSpaceTest(unittest.TestCase):
|
||||
self.assertEqual(config1, config2)
|
||||
self.assertIn(config1["a"], [2, 3, 4])
|
||||
self.assertIn(config1["b"]["x"], list(range(5)))
|
||||
self.assertEqual(config1["b"]["y"], 4)
|
||||
self.assertLess(1e-4, config1["b"]["z"])
|
||||
self.assertLess(config1["b"]["z"], 1e-2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user