test_views.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Fabrik 作者: Cloud-CV 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号