Skip to content

Commit 663a11a

Browse files
committed
bugfix and follow comment
1 parent d0c65bf commit 663a11a

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

paddle/fluid/inference/analysis/CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ function (inference_analysis_test TARGET)
2525
if(WITH_TESTING)
2626
set(options "")
2727
set(oneValueArgs "")
28-
set(multiValueArgs SRCS EXTRA_DEPS)
28+
set(multiValueArgs SRCS ARGS EXTRA_DEPS)
2929
cmake_parse_arguments(analysis_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
30-
3130
set(mem_opt "")
3231
if(WITH_GPU)
3332
set(mem_opt "--fraction_of_gpu_memory_to_use=0.5")
3433
endif()
3534
cc_test(${TARGET}
3635
SRCS "${analysis_test_SRCS}"
3736
DEPS analysis graph fc_fuse_pass graph_viz_pass infer_clean_graph_pass graph_pattern_detector pass ${analysis_test_EXTRA_DEPS}
38-
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model ${mem_opt})
37+
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model ${mem_opt} ${analysis_test_ARGS})
3938
set_tests_properties(${TARGET} PROPERTIES DEPENDS test_word2vec)
4039
endif(WITH_TESTING)
4140
endfunction(inference_analysis_test)
@@ -70,8 +69,7 @@ inference_analysis_test(test_analyzer SRCS analyzer_tester.cc
7069
attention_lstm_fuse_pass
7170
paddle_inference_api
7271
pass
73-
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model
74-
--infer_ditu_rnn_model=${DITU_INSTALL_DIR}/model
72+
ARGS --infer_ditu_rnn_model=${DITU_INSTALL_DIR}/model
7573
--infer_ditu_rnn_data=${DITU_INSTALL_DIR}/data.txt)
7674

7775
inference_analysis_test(test_data_flow_graph SRCS data_flow_graph_tester.cc)
@@ -93,8 +91,7 @@ if (NOT EXISTS ${CHINESE_NER_INSTALL_DIR})
9391
inference_download_and_uncompress(${CHINESE_NER_INSTALL_DIR} ${CHINESE_NER_DATA_URL} "chinese_ner-data.txt.tar.gz")
9492
endif()
9593

96-
inference_analysis_test(test_chinese_ner SRCS chinese_ner_tester.cc
94+
inference_analysis_test(test_analyzer_ner SRCS analyzer_ner_tester.cc
9795
EXTRA_DEPS paddle_inference_api paddle_fluid_api
98-
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model
99-
--infer_model=${CHINESE_NER_INSTALL_DIR}/model
96+
ARGS --infer_model=${CHINESE_NER_INSTALL_DIR}/model
10097
--infer_data=${CHINESE_NER_INSTALL_DIR}/data.txt)

paddle/fluid/inference/analysis/chinese_ner_tester.cc renamed to paddle/fluid/inference/analysis/analyzer_ner_tester.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include "paddle/fluid/inference/analysis/analyzer.h"
1516
#include <google/protobuf/text_format.h>
1617
#include <gtest/gtest.h>
1718
#include "paddle/fluid/framework/ir/pass.h"
18-
#include "paddle/fluid/inference/analysis/analyzer.h"
1919
#include "paddle/fluid/inference/analysis/ut_helper.h"
2020
#include "paddle/fluid/inference/api/helper.h"
2121
#include "paddle/fluid/inference/api/paddle_inference_api.h"

paddle/fluid/inference/api/api_impl.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ void NativePaddlePredictor::PrepareFeedFetch() {
6262
for (auto *op : inference_program_->Block(0).AllOps()) {
6363
if (op->Type() == "feed") {
6464
int idx = boost::get<int>(op->GetAttr("col"));
65-
if (feeds_.size() <= (size_t)idx) {
65+
if (feeds_.size() <= static_cast<size_t>(idx)) {
6666
feeds_.resize(idx + 1);
6767
}
6868
feeds_[idx] = op;
6969
feed_names_[op->Output("Out")[0]] = idx;
7070
} else if (op->Type() == "fetch") {
7171
int idx = boost::get<int>(op->GetAttr("col"));
72-
if (fetchs_.size() <= (size_t)idx) {
72+
if (fetchs_.size() <= static_cast<size_t>(idx)) {
7373
fetchs_.resize(idx + 1);
7474
}
7575
fetchs_[idx] = op;

0 commit comments

Comments
 (0)