diff --git a/build.sh b/build.sh index 4191bb8f35d..af8cd3164a1 100755 --- a/build.sh +++ b/build.sh @@ -519,11 +519,6 @@ build_opencl() { fi } -build_gtest() { - cd ${BASEPATH} - git submodule update --init --recursive third_party/googletest -} - build_opencv() { cd ${BASEPATH} if [[ "${INC_BUILD}" == "off" ]]; then @@ -566,7 +561,6 @@ build_minddata_lite_deps() build_opencv build_eigen build_jpeg_turbo - build_gtest } build_lite() diff --git a/mindspore/ccsrc/minddata/dataset/api/execute.cc b/mindspore/ccsrc/minddata/dataset/api/execute.cc index 78acf38469c..33eb117cb67 100644 --- a/mindspore/ccsrc/minddata/dataset/api/execute.cc +++ b/mindspore/ccsrc/minddata/dataset/api/execute.cc @@ -46,7 +46,7 @@ std::shared_ptr Execute::operator()(std::shared_ptr(new tensor::DETensor(std::move(de_output))); + return std::make_shared(std::move(de_output)); } diff --git a/mindspore/ccsrc/minddata/dataset/include/de_tensor.h b/mindspore/ccsrc/minddata/dataset/include/de_tensor.h index 5b9a36ef1ff..8980de7abcf 100644 --- a/mindspore/ccsrc/minddata/dataset/include/de_tensor.h +++ b/mindspore/ccsrc/minddata/dataset/include/de_tensor.h @@ -1,6 +1,5 @@ - -#ifndef DATASET_INCLUDE_DETENSOR_H_ -#define DATASET_INCLUDE_DETENSOR_H_ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_ #include "include/ms_tensor.h" #include "minddata/dataset/include/tensor.h" #include "minddata/dataset/util/status.h" @@ -8,46 +7,50 @@ namespace mindspore { namespace tensor { class DETensor : public MSTensor { public: - // brief Create a MSTensor pointer. - // - // param data_type DataTypeId of tensor to be created. - // param shape Shape of tensor to be created. - // return MSTensor pointer. - static MSTensor *CreateTensor(TypeId data_type, const std::vector &shape); + /// \brief Create a MSTensor pointer. + /// \param[data_type] DataTypeId of tensor to be created. + /// \param[shape] Shape of tensor to be created. + /// \return - MSTensor pointer. + static MSTensor *CreateTensor(TypeId data_type, const std::vector &shape); - static MSTensor *CreateTensor(const std::string &path); + /// \brief Create a MSTensor pointer. + /// \param[path] Path file to be read. + /// \return - MSTensor pointer. + static MSTensor *CreateTensor(const std::string &path); - DETensor(TypeId data_type, const std::vector &shape); + DETensor(TypeId data_type, const std::vector &shape); - explicit DETensor(std::shared_ptr tensor_ptr); + explicit DETensor(std::shared_ptr tensor_ptr); - ~DETensor() = default; + ~DETensor() = default; - MSTensor *ConvertToLiteTensor(); + /// \brief Create a duplicate instance, convert the DETensor to the LiteTensor. + /// \return - MSTensor pointer. + MSTensor *ConvertToLiteTensor(); - std::shared_ptr tensor() const; + std::shared_ptr tensor() const; - TypeId data_type() const override; + TypeId data_type() const override; - TypeId set_data_type(const TypeId data_type) override; + TypeId set_data_type(const TypeId data_type) override; - std::vector shape() const override; + std::vector shape() const override; - size_t set_shape(const std::vector &shape) override; + size_t set_shape(const std::vector &shape) override; - int DimensionSize(size_t index) const override; + int DimensionSize(size_t index) const override; - int ElementsNum() const override; + int ElementsNum() const override; - std::size_t hash() const override; + std::size_t hash() const override; - size_t Size() const override; + size_t Size() const override; - void *MutableData() const override; + void *MutableData() const override; protected: - std::shared_ptr tensor_impl_; + std::shared_ptr tensor_impl_; }; } // namespace tensor } // namespace mindspore -#endif // DATASET_INCLUDE_DETENSOR_H_ \ No newline at end of file +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_ \ No newline at end of file diff --git a/mindspore/lite/test/ut/src/dataset/de_tensor_test.cc b/mindspore/lite/test/ut/src/dataset/de_tensor_test.cc index 431216cb946..13120405eb9 100644 --- a/mindspore/lite/test/ut/src/dataset/de_tensor_test.cc +++ b/mindspore/lite/test/ut/src/dataset/de_tensor_test.cc @@ -1,5 +1,5 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/mindspore/lite/test/ut/src/dataset/eager_test.cc b/mindspore/lite/test/ut/src/dataset/eager_test.cc index 2a173a8a0f9..6cacfffdfa1 100644 --- a/mindspore/lite/test/ut/src/dataset/eager_test.cc +++ b/mindspore/lite/test/ut/src/dataset/eager_test.cc @@ -62,104 +62,3 @@ TEST_F(MindDataTestEager, Test1) { double elapsed_time_ms = std::chrono::duration(t_end-t_start).count(); MS_LOG(INFO) << "duration: " << elapsed_time_ms << " ms\n"; } - -/* -TEST_F(MindDataTestEager, Test2) { - // string dir for image folder - std::string in_dir = datasets_root_path_ + "/testPK/data"; - // run dataset with decode = on - std::shared_ptr ds = ImageFolder(in_dir, true, RandomSampler(false)); - std::shared_ptr normalize_op = vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}); - EXPECT_TRUE(normalize_op != nullptr); - std::shared_ptr resize_op = vision::Resize({224, 224}); - EXPECT_TRUE(resize_op != nullptr); - ds = ds->Map({normalize_op, resize_op}); - EXPECT_TRUE(ds != nullptr); - // Create an iterator over the result of the above dataset - // This will trigger the creation of the Execution Tree and launch it. - std::shared_ptr iter = ds->CreateIterator(); - EXPECT_TRUE(iter != nullptr); - - // Iterate the dataset and get each row - std::unordered_map> row; - iter->GetNextRow(&row); - - uint64_t i = 0; - while (row.size() != 0) { - i++; - auto image = row["image"]; - MS_LOG(INFO) << "Tensor image shape: " << image->shape(); - iter->GetNextRow(&row); - } - MS_LOG(WARNING) << i << "."; - iter->Stop(); - -} - -TEST_F(MindDataTestEager, Test3) { - // string dir for image folder - ConfigManager cm = ConfigManager(); - cm.set_num_parallel_workers(1); - std::string in_dir = datasets_root_path_ + "/testPK/data"; - // run dataset with decode = on - std::shared_ptr ds = ImageFolder(in_dir, true, RandomSampler(false)); - std::shared_ptr normalize_op = vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}); - EXPECT_TRUE(normalize_op != nullptr); - std::shared_ptr resize_op = vision::Resize({224, 224}); - EXPECT_TRUE(resize_op != nullptr); - ds = ds->Map({normalize_op, resize_op}); - EXPECT_TRUE(ds != nullptr); - // Create an iterator over the result of the above dataset - // This will trigger the creation of the Execution Tree and launch it. - std::shared_ptr iter = ds->CreateIterator(); - EXPECT_TRUE(iter != nullptr); - - // Iterate the dataset and get each row - std::unordered_map> row; - iter->GetNextRow(&row); - - uint64_t i = 0; - while (row.size() != 0) { - i++; - auto image = row["image"]; - MS_LOG(INFO) << "Tensor image shape: " << image->shape(); - iter->GetNextRow(&row); - } - MS_LOG(WARNING) << i << "."; - iter->Stop(); - -} - -TEST_F(MindDataTestEager, Test4) { - // string dir for image folder - ConfigManager cm = ConfigManager(); - cm.set_num_parallel_workers(1); - std::string in_dir = datasets_root_path_ + "/testPK/data"; - // run dataset with decode = on - std::shared_ptr ds = ImageFolder(in_dir, true, RandomSampler(false)); - // Create an iterator over the result of the above dataset - // This will trigger the creation of the Execution Tree and launch it. - std::shared_ptr iter = ds->CreateIterator(); - EXPECT_TRUE(iter != nullptr); - - // Iterate the dataset and get each row - std::unordered_map> row; - iter->GetNextRow(&row); - - uint64_t i = 0; - while (row.size() != 0) { - i++; - auto image = row["image"]; - image = Execute(vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}))(image); - EXPECT_TRUE(image != nullptr); - image = Execute(vision::Resize({224, 224}))(image); - EXPECT_TRUE(image != nullptr); - - MS_LOG(INFO) << "Tensor image shape: " << image->shape(); - iter->GetNextRow(&row); - } - MS_LOG(WARNING) << i << "."; - iter->Stop(); - -} -*/