未验证 提交 a040239d 编写于 作者: S Siddharth Goyal 提交者: GitHub

Add conv test case for inference-recognize digits (#8466)

上级 65fd84a5
...@@ -27,7 +27,7 @@ endfunction(inference_test) ...@@ -27,7 +27,7 @@ endfunction(inference_test)
inference_test(fit_a_line) inference_test(fit_a_line)
inference_test(image_classification ARGS vgg resnet) inference_test(image_classification ARGS vgg resnet)
inference_test(label_semantic_roles) inference_test(label_semantic_roles)
inference_test(recognize_digits ARGS mlp) inference_test(recognize_digits ARGS mlp conv)
inference_test(recommender_system) inference_test(recommender_system)
#inference_test(rnn_encoder_decoder) #inference_test(rnn_encoder_decoder)
inference_test(understand_sentiment) inference_test(understand_sentiment)
......
...@@ -77,7 +77,7 @@ TEST(inference, recognize_digits_combine) { ...@@ -77,7 +77,7 @@ TEST(inference, recognize_digits_combine) {
// Use normilized image pixels as input data, // Use normilized image pixels as input data,
// which should be in the range [-1.0, 1.0]. // which should be in the range [-1.0, 1.0].
SetupTensor<float>( SetupTensor<float>(
input, {1, 28, 28}, static_cast<float>(-1), static_cast<float>(1)); input, {1, 1, 28, 28}, static_cast<float>(-1), static_cast<float>(1));
std::vector<paddle::framework::LoDTensor*> cpu_feeds; std::vector<paddle::framework::LoDTensor*> cpu_feeds;
cpu_feeds.push_back(&input); cpu_feeds.push_back(&input);
......
...@@ -141,7 +141,7 @@ def train(nn_type, use_cuda, parallel, save_dirname, save_param_filename): ...@@ -141,7 +141,7 @@ def train(nn_type, use_cuda, parallel, save_dirname, save_param_filename):
# get test acc and loss # get test acc and loss
acc_val = numpy.array(acc_set).mean() acc_val = numpy.array(acc_set).mean()
avg_loss_val = numpy.array(avg_loss_set).mean() avg_loss_val = numpy.array(avg_loss_set).mean()
if float(acc_val) > 0.85: # test acc > 85% if float(acc_val) > 0.2: # Smaller value to increase CI speed
if save_dirname is not None: if save_dirname is not None:
fluid.io.save_inference_model( fluid.io.save_inference_model(
save_dirname, ["img"], [prediction], save_dirname, ["img"], [prediction],
...@@ -235,8 +235,9 @@ def inject_all_tests(): ...@@ -235,8 +235,9 @@ def inject_all_tests():
for nn_type in ('mlp', 'conv'): for nn_type in ('mlp', 'conv'):
inject_test_method(use_cuda, parallel, nn_type, True) inject_test_method(use_cuda, parallel, nn_type, True)
# One unit-test for saving parameters as separate files # Two unit-test for saving parameters as separate files
inject_test_method(False, False, 'mlp', False) inject_test_method(False, False, 'mlp', False)
inject_test_method(False, False, 'conv', False)
inject_all_tests() inject_all_tests()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册