From 16673fbca948174d29f40d46a17da5fdabcb7237 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 9 Nov 2020 23:40:06 -0500 Subject: [PATCH] Added signature for eager execute Added fix for album, removed ifdef --- .../ccsrc/minddata/dataset/api/execute.cc | 24 +++++++++++++++++++ .../dataset/engine/cache/cache_grpc_server.cc | 7 ++---- .../minddata/dataset/engine/data_schema.cc | 6 +---- .../dataset/engine/datasetops/cache_op.cc | 6 +---- .../engine/datasetops/epoch_ctrl_op.cc | 6 +---- .../dataset/engine/datasetops/filter_op.cc | 6 +---- .../engine/datasetops/map_op/map_op.cc | 6 +---- .../dataset/engine/datasetops/project_op.cc | 6 +---- .../dataset/engine/datasetops/rename_op.cc | 6 +---- .../dataset/engine/datasetops/repeat_op.cc | 7 +----- .../dataset/engine/datasetops/shuffle_op.cc | 7 +----- .../dataset/engine/datasetops/skip_op.cc | 7 +----- .../engine/datasetops/source/album_op.cc | 4 ++-- .../engine/datasetops/source/mindrecord_op.cc | 6 +---- .../dataset/engine/datasetops/zip_op.cc | 6 +---- .../dataset/engine/gnn/graph_shared_memory.cc | 7 +----- .../dataset/engine/gnn/grpc_async_server.cc | 7 +----- .../minddata/dataset/engine/perf/profiling.cc | 6 +---- .../minddata/dataset/engine/tdt/tdt_plugin.cc | 7 +----- .../ccsrc/minddata/dataset/include/execute.h | 2 ++ 20 files changed, 46 insertions(+), 93 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/api/execute.cc b/mindspore/ccsrc/minddata/dataset/api/execute.cc index 23222c4d47..91f486f3f9 100644 --- a/mindspore/ccsrc/minddata/dataset/api/execute.cc +++ b/mindspore/ccsrc/minddata/dataset/api/execute.cc @@ -53,5 +53,29 @@ std::shared_ptr Execute::operator()(std::shared_ptr(std::move(de_output)); } +std::shared_ptr Execute::operator()(std::shared_ptr input) { + // Build the op + if (op_ == nullptr) { + MS_LOG(ERROR) << "Input TensorOperation is not valid"; + return nullptr; + } + + if (input == nullptr) { + MS_LOG(ERROR) << "Input Tensor is not valid"; + return nullptr; + } + // will add validate params once API is set + std::shared_ptr transform = op_->Build(); + std::shared_ptr de_output; + Status rc = transform->Compute(input, &de_output); + + if (rc.IsError()) { + // execution failed + MS_LOG(ERROR) << "Operation execution failed : " << rc.ToString(); + return nullptr; + } + return de_output; +} + } // namespace dataset } // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_grpc_server.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_grpc_server.cc index 8aaf98fde1..8b83b3fefa 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_grpc_server.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_grpc_server.cc @@ -19,11 +19,8 @@ #include "minddata/dataset/engine/cache/cache_server.h" #include "minddata/dataset/util/path.h" #include "minddata/dataset/util/task_manager.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" + namespace mindspore { namespace dataset { CacheServerGreeterImpl::CacheServerGreeterImpl(int32_t port, int32_t shared_memory_sz_in_gb) diff --git a/mindspore/ccsrc/minddata/dataset/engine/data_schema.cc b/mindspore/ccsrc/minddata/dataset/engine/data_schema.cc index bffb87f0c6..db75597198 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/data_schema.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/data_schema.cc @@ -26,11 +26,7 @@ #include "utils/ms_utils.h" #include "minddata/dataset/util/status.h" #include "minddata/dataset/core/tensor_shape.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.cc index fea1913988..0408eab1bf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.cc @@ -25,12 +25,8 @@ #include "minddata/dataset/engine/data_buffer.h" #include "minddata/dataset/engine/execution_tree.h" #include "minddata/dataset/engine/opt/pass.h" +#include "minddata/dataset/util/log_adapter.h" #include "minddata/dataset/util/task_manager.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc index 1eb9eecc8e..ab3ce93f48 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc @@ -22,11 +22,7 @@ #include "minddata/dataset/engine/data_buffer.h" #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/opt/pass.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc index 6e6b3fd6fd..e02eafffb8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc @@ -29,11 +29,7 @@ #include "minddata/dataset/engine/execution_tree.h" #include "minddata/dataset/engine/opt/pass.h" #include "minddata/dataset/kernels/tensor_op.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" #include "minddata/dataset/util/task_manager.h" namespace mindspore { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op/map_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op/map_op.cc index 3c1e6f4cba..a00482df1c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op/map_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op/map_op.cc @@ -28,12 +28,8 @@ #include "minddata/dataset/engine/datasetops/map_op/gpu_map_job.h" #include "minddata/dataset/engine/opt/pass.h" #include "minddata/dataset/kernels/tensor_op.h" +#include "minddata/dataset/util/log_adapter.h" #include "minddata/dataset/util/task_manager.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc index b88578b32f..393af17f4b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc @@ -26,11 +26,7 @@ #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/execution_tree.h" #include "minddata/dataset/engine/opt/pass.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc index b3f73b37b7..da8597c683 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc @@ -25,11 +25,7 @@ #include "minddata/dataset/engine/data_buffer.h" #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/opt/pass.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc index 6afa4eda4d..9aa5e301e5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc @@ -22,12 +22,7 @@ #include "minddata/dataset/engine/data_buffer.h" #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/opt/pass.h" - -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc index 1259cfcb1c..fd4c81c2e7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc @@ -31,15 +31,10 @@ #include "minddata/dataset/engine/data_buffer.h" #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/opt/pass.h" +#include "minddata/dataset/util/log_adapter.h" #include "minddata/dataset/util/random.h" #include "minddata/dataset/util/status.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif - namespace mindspore { namespace dataset { constexpr int32_t ShuffleOp::kShuffleStateInit; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc index 63fc04776b..7a6cc90b50 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc @@ -23,12 +23,7 @@ #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/execution_tree.h" #include "minddata/dataset/engine/opt/pass.h" - -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc index a2cc45a192..65c2cdde30 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc @@ -265,8 +265,8 @@ Status AlbumOp::LoadImageTensor(const std::string &image_file_path, uint32_t col fs.open(image_file_path, std::ios::binary | std::ios::in); if (fs.fail()) { MS_LOG(INFO) << "Image file not found:" << image_file_path << "."; - // If file doesn't exist, we don't flag this as error in input check, simply skip - return Status::OK(); + // If file doesn't exist, we don't flag this as error in input check, simply push back empty tensor + RETURN_STATUS_UNEXPECTED("Invalid file_path, failed to read file: " + image_file_path); } MS_LOG(INFO) << "Image file found: " << image_file_path << "."; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mindrecord_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mindrecord_op.cc index 9f8b63be1d..84de09a6ce 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mindrecord_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mindrecord_op.cc @@ -30,11 +30,7 @@ #include "minddata/dataset/engine/db_connector.h" #include "minddata/dataset/engine/execution_tree.h" #include "minddata/dataset/engine/opt/pass.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc index dd9edecb59..8367b5b37a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc @@ -23,11 +23,7 @@ #include "minddata/dataset/engine/opt/pass.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/global_context.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.cc b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.cc index 019f1513fa..0bf4575517 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.cc @@ -17,12 +17,7 @@ #include "minddata/dataset/engine/gnn/graph_shared_memory.h" #include - -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/grpc_async_server.cc b/mindspore/ccsrc/minddata/dataset/engine/gnn/grpc_async_server.cc index 2202f2f75b..a136427978 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/grpc_async_server.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/grpc_async_server.cc @@ -16,13 +16,8 @@ #include "minddata/dataset/engine/gnn/grpc_async_server.h" #include - +#include "minddata/dataset/util/log_adapter.h" #include "minddata/dataset/util/task_manager.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.cc b/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.cc index e94b814bcb..0ca5a392cf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.cc @@ -25,11 +25,7 @@ #include "minddata/dataset/engine/perf/connector_size.h" #include "minddata/dataset/engine/perf/connector_throughput.h" #include "minddata/dataset/engine/perf/dataset_iterator_tracing.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/tdt/tdt_plugin.cc b/mindspore/ccsrc/minddata/dataset/engine/tdt/tdt_plugin.cc index 5f4834c80f..f0525c340e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/tdt/tdt_plugin.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/tdt/tdt_plugin.cc @@ -15,13 +15,8 @@ */ #include "minddata/dataset/engine/tdt/tdt_plugin.h" #include "utils/ms_utils.h" -#ifndef ENABLE_ANDROID -#include "utils/log_adapter.h" -#else -#include "mindspore/lite/src/common/log_adapter.h" -#endif #include "minddata/dataset/engine/perf/profiling.h" - +#include "minddata/dataset/util/log_adapter.h" namespace mindspore { namespace dataset { static std::shared_ptr instance_ptr_ = nullptr; diff --git a/mindspore/ccsrc/minddata/dataset/include/execute.h b/mindspore/ccsrc/minddata/dataset/include/execute.h index 7ff158efc5..b3457aa487 100644 --- a/mindspore/ccsrc/minddata/dataset/include/execute.h +++ b/mindspore/ccsrc/minddata/dataset/include/execute.h @@ -21,6 +21,7 @@ #include #include "minddata/dataset/core/constants.h" #include "minddata/dataset/include/de_tensor.h" +#include "minddata/dataset/include/tensor.h" #include "minddata/dataset/include/transforms.h" namespace mindspore { @@ -38,6 +39,7 @@ class Execute { /// \param[inout] input - the tensor to be transformed /// \return - the output tensor, nullptr if Compute fails std::shared_ptr operator()(std::shared_ptr input); + std::shared_ptr operator()(std::shared_ptr input); private: std::shared_ptr op_;