def test_json_to_prototxt(self):
tests = open(os.path.join(settings.BASE_DIR, 'tests', 'unit', 'ide',
'caffe_export_test.json'), 'r')
response = json.load(tests)
tests.close()
net = yaml.safe_load(json.dumps(response['net']))
net = {'l0': net['Input'], 'l1': net['HDF5Output']}
net['l0']['connection']['output'].append('l1')
# Test 1
prototxt, input_dim = json_to_prototxt(net, response['net_name'])
self.assertGreater(len(prototxt), 9)
self.assertEqual(net['l1']['info']['type'], 'HDF5Output')
# Test 2
net['l1']['info']['phase'] = 0
prototxt, input_dim = json_to_prototxt(net, response['net_name'])
self.assertGreater(len(prototxt), 9)
self.assertEqual(net['l1']['info']['type'], 'HDF5Output')
# Test 3
net['l1']['info']['phase'] = 1
prototxt, input_dim = json_to_prototxt(net, response['net_name'])
self.assertGreater(len(prototxt), 9)
self.assertEqual(net['l1']['info']['type'], 'HDF5Output')
评论列表
文章目录