提交 71982329 编写于 作者: E ervinzhang

rebased again

上级 6ace46d5
......@@ -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()
......
......@@ -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
......
......@@ -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
......
......@@ -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() {}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册