def test_caffe_import(self):
# Test 1
top = L.Deconvolution(convolution_param=dict(kernel_size=3, pad=1, stride=1, num_output=128,
weight_filler={'type': 'xavier'}, bias_filler={'type': 'constant'}))
with open(os.path.join(settings.BASE_DIR, 'media', 'test.prototxt'), 'w') as f:
f.write(str(to_proto(top)))
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']), 6)
self.assertEqual(response['result'], 'success')
# Test 2
top = L.Deconvolution(convolution_param=dict(kernel_w=3, kernel_h=3, pad_w=1, pad_h=1, stride=1,
num_output=128, dilation=1, weight_filler={'type': 'xavier'},
bias_filler={'type': 'constant'}))
with open(os.path.join(settings.BASE_DIR, 'media', 'test.prototxt'), 'w') as f:
f.write(str(to_proto(top)))
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']), 6)
self.assertEqual(response['result'], 'success')
# ********** Recurrent Layers Test **********
评论列表
文章目录