diff --git a/03.image_classification/README.cn.md b/03.image_classification/README.cn.md index d28269f8d93670f4cf8a4e1dafd6a32f713b9051..9b82a2635593e052fff1bbbf38dc4147f9b7be6b 100644 --- a/03.image_classification/README.cn.md +++ b/03.image_classification/README.cn.md @@ -538,11 +538,7 @@ with fluid.scope_guard(inference_scope): [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model(params_dirname, exe) - # The input's dimension of conv should be 4-D or 5-D. - # Use inference_transpiler to speedup - inference_transpiler_program = inference_program.clone() - t = fluid.transpiler.InferenceTranspiler() - t.transpile(inference_transpiler_program, place) + # Construct feed as a dictionary of {feed_target_name: feed_target_data} # and results will contain a list of data corresponding to fetch_targets. @@ -550,14 +546,6 @@ with fluid.scope_guard(inference_scope): feed={feed_target_names[0]: img}, fetch_list=fetch_targets) - transpiler_results = exe.run(inference_transpiler_program, - feed={feed_target_names[0]: img}, - fetch_list=fetch_targets) - - assert len(results[0]) == len(transpiler_results[0]) - for i in range(len(results[0])): - numpy.testing.assert_almost_equal( - results[0][i], transpiler_results[0][i], decimal=5) # infer label label_list = [ diff --git a/03.image_classification/README.md b/03.image_classification/README.md index 661ff53fb22abeacc725281315a23806d94c3d50..7526cb132e4b8b6b5a338e7715feaafadb8d02a5 100644 --- a/03.image_classification/README.md +++ b/03.image_classification/README.md @@ -541,11 +541,7 @@ with fluid.scope_guard(inference_scope): [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model(params_dirname, exe) - # The input's dimension of conv should be 4-D or 5-D. - # Use inference_transpiler to speedup - inference_transpiler_program = inference_program.clone() - t = fluid.transpiler.InferenceTranspiler() - t.transpile(inference_transpiler_program, place) + # Construct feed as a dictionary of {feed_target_name: feed_target_data} # and results will contain a list of data corresponding to fetch_targets. @@ -553,14 +549,7 @@ with fluid.scope_guard(inference_scope): feed={feed_target_names[0]: img}, fetch_list=fetch_targets) - transpiler_results = exe.run(inference_transpiler_program, - feed={feed_target_names[0]: img}, - fetch_list=fetch_targets) - assert len(results[0]) == len(transpiler_results[0]) - for i in range(len(results[0])): - numpy.testing.assert_almost_equal( - results[0][i], transpiler_results[0][i], decimal=5) # infer label label_list = [ diff --git a/03.image_classification/index.cn.html b/03.image_classification/index.cn.html index 376054e06c099d546af78eb641f61c75c7a3fa0f..3a66d5c98968b14c256e77e699a386f07cc0b806 100644 --- a/03.image_classification/index.cn.html +++ b/03.image_classification/index.cn.html @@ -580,11 +580,7 @@ with fluid.scope_guard(inference_scope): [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model(params_dirname, exe) - # The input's dimension of conv should be 4-D or 5-D. - # Use inference_transpiler to speedup - inference_transpiler_program = inference_program.clone() - t = fluid.transpiler.InferenceTranspiler() - t.transpile(inference_transpiler_program, place) + # Construct feed as a dictionary of {feed_target_name: feed_target_data} # and results will contain a list of data corresponding to fetch_targets. @@ -592,14 +588,6 @@ with fluid.scope_guard(inference_scope): feed={feed_target_names[0]: img}, fetch_list=fetch_targets) - transpiler_results = exe.run(inference_transpiler_program, - feed={feed_target_names[0]: img}, - fetch_list=fetch_targets) - - assert len(results[0]) == len(transpiler_results[0]) - for i in range(len(results[0])): - numpy.testing.assert_almost_equal( - results[0][i], transpiler_results[0][i], decimal=5) # infer label label_list = [ diff --git a/03.image_classification/index.html b/03.image_classification/index.html index fcf8c744a402236b9a623096dea05094ec0f248f..7eaca4f528a41895139ce3c9f80b48dc59223e98 100644 --- a/03.image_classification/index.html +++ b/03.image_classification/index.html @@ -583,11 +583,7 @@ with fluid.scope_guard(inference_scope): [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model(params_dirname, exe) - # The input's dimension of conv should be 4-D or 5-D. - # Use inference_transpiler to speedup - inference_transpiler_program = inference_program.clone() - t = fluid.transpiler.InferenceTranspiler() - t.transpile(inference_transpiler_program, place) + # Construct feed as a dictionary of {feed_target_name: feed_target_data} # and results will contain a list of data corresponding to fetch_targets. @@ -595,14 +591,7 @@ with fluid.scope_guard(inference_scope): feed={feed_target_names[0]: img}, fetch_list=fetch_targets) - transpiler_results = exe.run(inference_transpiler_program, - feed={feed_target_names[0]: img}, - fetch_list=fetch_targets) - assert len(results[0]) == len(transpiler_results[0]) - for i in range(len(results[0])): - numpy.testing.assert_almost_equal( - results[0][i], transpiler_results[0][i], decimal=5) # infer label label_list = [ diff --git a/03.image_classification/train.py b/03.image_classification/train.py index 78bf1ce45d9e176690f73cc70c8c172df2dbf141..47df1809b055e0b90c126816c49521e4166cc3f3 100644 --- a/03.image_classification/train.py +++ b/03.image_classification/train.py @@ -191,12 +191,6 @@ def infer(use_cuda, params_dirname=None): [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model(params_dirname, exe) - # The input's dimension of conv should be 4-D or 5-D. - # Use inference_transpiler to speedup - inference_transpiler_program = inference_program.clone() - t = fluid.transpiler.InferenceTranspiler() - t.transpile(inference_transpiler_program, place) - # Construct feed as a dictionary of {feed_target_name: feed_target_data} # and results will contain a list of data corresponding to fetch_targets. results = exe.run( @@ -204,16 +198,6 @@ def infer(use_cuda, params_dirname=None): feed={feed_target_names[0]: img}, fetch_list=fetch_targets) - transpiler_results = exe.run( - inference_transpiler_program, - feed={feed_target_names[0]: img}, - fetch_list=fetch_targets) - - assert len(results[0]) == len(transpiler_results[0]) - for i in range(len(results[0])): - numpy.testing.assert_almost_equal( - results[0][i], transpiler_results[0][i], decimal=5) - # infer label label_list = [ "airplane", "automobile", "bird", "cat", "deer", "dog", "frog",