def test_builder_4(self): """dlbs -> TestBuilder::test_builder_4 [Test for plan builder #4.]""" plan = Builder.build( { 'parameters': {'exp.framework': 'TensorFlow', 'exp.model': 'vgg16'}, 'extensions': [ { 'condition': {'exp.framework': "TensorFlow"}, 'parameters': {'exp.device_batch': 128} } ] }, {}, {} ) Processor().compute_variables(plan) self.assertListEqual( plan, [ {'exp.framework': "TensorFlow", 'exp.model': 'vgg16', 'exp.device_batch': 128} ] )
def test_builder_9(self): """dlbs -> TestBuilder::test_builder_9 [Test for plan builder #9.]""" plan = Builder.build( { 'parameters': { 'exp.framework': 'bvlc_caffe', 'exp.model': 'vgg16', 'exp.path': '${${exp.fork}_caffe.path}', 'bvlc_caffe.path': '/opt/caffe' }, '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', 'bvlc_caffe.path': '/opt/caffe', 'exp.path': '/opt/caffe' }])
def build_plan(self, params): self.plan = Builder.build(self.config, params=params, variables={})