def executor_test_settings(func): if hu.is_sandcastle() or hu.is_travis(): return settings( max_examples=CI_MAX_EXAMPLES, timeout=CI_TIMEOUT )(func) else: return func
def executor_test_settings(func): if hu.is_sandcastle() or hu.is_travis(): return hu.settings( max_examples=CI_MAX_EXAMPLES, deadline=CI_TIMEOUT * 1000 # deadline is in ms )(func) else: return func
def executor_test_model_names(): if not hu.is_travis(): return conv_model_generators().keys() else: return ["MLP"]
def executor_test_model_names(): if hu.is_sandcastle() or hu.is_travis(): return ["MLP"] else: return conv_model_generators().keys()
import unittest EXECUTORS = ["dag", "async_dag"] ITERATIONS = 2 CI_MAX_EXAMPLES = 2 CI_TIMEOUT = 600 def test_settings(func): if hu.is_sandcastle() or hu.is_travis(): return settings(max_examples=CI_MAX_EXAMPLES, timeout=CI_TIMEOUT)(func) else: return func @unittest.skipIf(hu.is_travis(), "Disabled in Travis") class ExecutorCPUConvNetTest(ExecutorTestBase): @given(executor=st.sampled_from(EXECUTORS), model_name=st.sampled_from(conv_model_generators().keys()), batch_size=st.sampled_from([8]), num_workers=st.sampled_from([8])) @test_settings def test_executor(self, executor, model_name, batch_size, num_workers): model = build_conv_model(model_name, batch_size) model.Proto().num_workers = num_workers def run_model(): iterations = ITERATIONS if model_name == "MLP": iterations = 1 # avoid numeric instability with MLP gradients workspace.RunNet(model.net, iterations)