CMakeLists.txt 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
function(inference_test TARGET_NAME)
  set(options "")
  set(oneValueArgs "")
  set(multiValueArgs ARGS)
  cmake_parse_arguments(inference_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  set(PYTHON_TESTS_DIR ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/tests)
  if(inference_test_ARGS)
    foreach(arg ${inference_test_ARGS})
      cc_test(test_inference_${TARGET_NAME}_${arg}
          SRCS test_inference_${TARGET_NAME}.cc
          DEPS ARCHIVE_START paddle_fluid ARCHIVE_END
          ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}_${arg}.inference.model)
      set_tests_properties(test_inference_${TARGET_NAME}_${arg}
          PROPERTIES DEPENDS test_${TARGET_NAME})
    endforeach()
  else()
    cc_test(test_inference_${TARGET_NAME}
        SRCS test_inference_${TARGET_NAME}.cc
        DEPS ARCHIVE_START paddle_fluid ARCHIVE_END
        ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}.inference.model)
    set_tests_properties(test_inference_${TARGET_NAME}
        PROPERTIES DEPENDS test_${TARGET_NAME})
  endif()
endfunction(inference_test)

inference_test(recognize_digits ARGS mlp)
inference_test(image_classification ARGS vgg resnet)
inference_test(label_semantic_roles)
K
Kexin Zhao 已提交
30
inference_test(rnn_encoder_decoder)