rebased again

This commit is contained in:
ervinzhang 2020-07-31 10:41:04 -04:00
parent 6ace46d516
commit 719823291b
4 changed files with 19 additions and 6 deletions

View File

@ -519,6 +519,11 @@ build_opencl() {
fi
}
build_gtest() {
cd ${BASEPATH}
git submodule update --init --recursive third_party/googletest
}
build_opencv() {
cd ${BASEPATH}
if [[ "${INC_BUILD}" == "off" ]]; then
@ -561,6 +566,7 @@ build_minddata_lite_deps()
build_opencv
build_eigen
build_jpeg_turbo
build_gtest
}
build_lite()

View File

@ -132,7 +132,7 @@ endif()
### minddata lite
if (BUILD_MINDDATA)
include_directories(${CCSRC_DIR}/minddata)
set(DATASET_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dataset)
set(DATASET_TEST_DIR ${TEST_DIR}/ut/src/dataset)
set(TEST_MINDDATA_SRC
${DATASET_TEST_DIR}/de_tensor_test.cc
${DATASET_TEST_DIR}/eager_test.cc
@ -294,6 +294,13 @@ endif ()
add_executable(lite-test ${TEST_SRC})
target_link_libraries(lite-test dl ${SECUREC_LIBRARY} ${GTEST_LIBRARY} mindspore::json)
if (BUILD_MINDDATA)
target_link_libraries(lite-test
minddata-lite
minddata-eager
log
)
endif()
if (BUILD_CONVERTER)
target_link_libraries(lite-test
anf_exporter_mid

View File

@ -25,7 +25,7 @@
using namespace mindspore::dataset;
class MindDataTestTensorDE : public UT::Common {
class MindDataTestTensorDE : public mindspore::Common {
public:
MindDataTestTensorDE() {}
};
@ -42,7 +42,7 @@ TEST_F(MindDataTestTensorDE, MSTensorConvertToLiteTensor) {
std::shared_ptr<mindspore::tensor::MSTensor> lite_ms_tensor = std::shared_ptr<mindspore::tensor::MSTensor>(
std::dynamic_pointer_cast<mindspore::tensor::DETensor>(ms_tensor)->ConvertToLiteTensor());
// check if the lite_ms_tensor is the derived LiteTensor
mindspore::tensor::LiteTensor * lite_tensor = static_cast<mindspore::tensor::LiteTensor *>(lite_ms_tensor.get());
mindspore::lite::tensor::LiteTensor * lite_tensor = static_cast<mindspore::lite::tensor::LiteTensor *>(lite_ms_tensor.get());
ASSERT_EQ(lite_tensor != nullptr, true);
}
@ -77,7 +77,7 @@ TEST_F(MindDataTestTensorDE, MSTensorDataType) {
TEST_F(MindDataTestTensorDE, MSTensorMutableData) {
std::vector<float> x = {2.5, 2.5, 2.5, 2.5};
std::shared_ptr<Tensor> t;
Tensor::CreateTensor(&t, x, TensorShape({2, 2}));
Tensor::CreateFromVector(x, TensorShape({2, 2}), &t);
auto ms_tensor = std::shared_ptr<mindspore::tensor::MSTensor>(new mindspore::tensor::DETensor(t));
float *data = static_cast<float*>(ms_tensor->MutableData());
std::vector<float> tensor_vec(data, data + ms_tensor->ElementsNum());
@ -88,7 +88,7 @@ TEST_F(MindDataTestTensorDE, MSTensorMutableData) {
TEST_F(MindDataTestTensorDE, MSTensorHash) {
std::vector<float> x = {2.5, 2.5, 2.5, 2.5};
std::shared_ptr<Tensor> t;
Tensor::CreateTensor(&t, x, TensorShape({2, 2}));
Tensor::CreateFromVector(x, TensorShape({2, 2}), &t);
auto ms_tensor = std::shared_ptr<mindspore::tensor::MSTensor>(new mindspore::tensor::DETensor(t));
#ifdef ENABLE_ARM64
ASSERT_EQ(ms_tensor->hash() == 11093771382437, true); // arm64

View File

@ -27,7 +27,7 @@ using namespace mindspore::dataset;
using namespace mindspore::dataset::api;
using namespace mindspore;
class MindDataTestEager : public UT::Common {
class MindDataTestEager : public mindspore::Common {
public:
MindDataTestEager() {}
};