def test_builder_7(self):
     """dlbs  ->  TestBuilder::test_builder_7                         [Test for plan builder #7.]"""
     plan = Builder.build(
         {
             'parameters': {
                 'exp.framework': 'TensorFlow',
                 'exp.model': 'vgg16'
             },
             'extensions': [{
                 'condition': {
                     'exp.framework': "TensorFlow"
                 },
                 'parameters': {
                     'exp.device_batch': 128
                 }
             }, {
                 'condition': {
                     'exp.framework': "TensorFlow"
                 },
                 'parameters': {
                     'exp.disabled': 'true'
                 }
             }]
         }, {}, {})
     Processor().compute_variables(plan)
     self.assertListEqual(plan, [{
         'exp.framework': "TensorFlow",
         'exp.model': 'vgg16',
         'exp.device_batch': 128,
         'exp.disabled': 'true'
     }])
 def test_builder_8(self):
     """dlbs  ->  TestBuilder::test_builder_8                         [Test for plan builder #8.]"""
     plan = Builder.build(
         {
             'parameters': {
                 'exp.framework': 'bvlc_caffe',
                 'exp.model': 'vgg16'
             },
             'extensions': [{
                 'condition': {
                     'exp.framework': "([^_]+)_(.+)"
                 },
                 'parameters': {
                     'exp.device_batch': 128,
                     'exp.framework_id':
                     '${__condition.exp.framework_0}',  # bvlc_caffe
                     'exp.fork': '${__condition.exp.framework_1}',  # bvlc
                     'exp.framework':
                     '${__condition.exp.framework_2}'  # caffe
                 }
             }]
         },
         {},
         {})
     Processor().compute_variables(plan)
     self.assertListEqual(plan, [{
         'exp.framework': "caffe",
         'exp.model': 'vgg16',
         'exp.device_batch': 128,
         'exp.framework_id': 'bvlc_caffe',
         'exp.fork': 'bvlc'
     }])
 def test_builder_5(self):
     """dlbs  ->  TestBuilder::test_builder_5                         [Test for plan builder #5.]"""
     plan = Builder.build(
         {
             'parameters': {
                 'exp.framework': 'TensorFlow',
                 'exp.device_batch': 256
             },
             'variables': {
                 'exp.model': ['vgg16', 'text_cnn']
             },
             'extensions': [{
                 'condition': {
                     'exp.framework': "TensorFlow",
                     'exp.model': 'text_cnn'
                 },
                 'parameters': {
                     'exp.device_batch': 512
                 }
             }]
         }, {}, {})
     Processor().compute_variables(plan)
     self.assertListEqual(plan, [{
         'exp.framework': "TensorFlow",
         'exp.model': 'vgg16',
         'exp.device_batch': 256
     }, {
         'exp.framework': "TensorFlow",
         'exp.model': 'text_cnn',
         'exp.device_batch': 512
     }])
 def build_plan(self, serialize=False):
     """Builds plan combining configuration, parameters and variables."""
     self.plan = Builder.build(self.config, self.params, self.variables)
     if serialize:
         if self.plan_file:
             DictUtils.dump_json_to_file(self.plan, self.plan_file)
         else:
             json.dump(self.plan, sys.stdout, indent=4)
             print('')
 def test_builder_2(self):
     """dlbs  ->  TestBuilder::test_builder_2                         [Test for plan builder #2.]"""
     plan = Builder.build(
         {'parameters': {'exp.framework': "TensorFlow", 'exp.model': 'vgg16'}},
         {'exp.device_batch': 16},
         {}
     )
     self.assertListEqual(
         plan,
         [{'exp.framework': "TensorFlow", 'exp.model': 'vgg16', 'exp.device_batch': 16}]
     )
 def test_builder_1(self):
     """dlbs  ->  TestBuilder::test_builder_1                         [Test for plan builder #1.]"""
     plan = Builder.build(
         {'parameters': {'exp.framework': "TensorFlow", 'exp.model': 'vgg16'}},
         {},
         {}
     )
     self.assertListEqual(
         plan,
         [{'exp.framework': "TensorFlow", 'exp.model': 'vgg16'}]
     )
 def test_builder_3(self):
     """dlbs  ->  TestBuilder::test_builder_3                         [Test for plan builder #3.]"""
     plan = Builder.build(
         {
             'parameters': {'exp.framework': "TensorFlow", 'exp.model': 'vgg16'},
             'variables': {'exp.device_batch': [16, 32]}
         },
         {},
         {}
     )
     self.assertListEqual(
         plan,
         [
             {'exp.framework': "TensorFlow", 'exp.model': 'vgg16', 'exp.device_batch': 16},
             {'exp.framework': "TensorFlow", 'exp.model': 'vgg16', 'exp.device_batch': 32}
         ]
     )
Exemple #8
0
 def build_plan(self, params):
     self.plan = Builder.build(self.config, params=params, variables={})