def test_caffe_import(self):
data = L.Input(shape={'dim': [10, 3, 224, 224]})
with open(os.path.join(settings.BASE_DIR, 'media', 'test.prototxt'), 'w') as f:
f.write(str(to_proto(data)))
sample_file = open(os.path.join(settings.BASE_DIR, 'media', 'test.prototxt'), 'r')
response = self.client.post(reverse('caffe-import'), {'file': sample_file})
response = json.loads(response.content)
os.remove(os.path.join(settings.BASE_DIR, 'media', 'test.prototxt'))
self.assertGreaterEqual(len(response['net']['l0']['params']), 1)
self.assertEqual(response['result'], 'success')
评论列表
文章目录