diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc index 62c49b92f32..ad02d938495 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc @@ -149,7 +149,7 @@ Status DatasetOp::Remove() { // If we remove B, then first take our child A and update it's parent to be C // It's possible the parent is null if we are the root node being removed. if (!child_.empty()) { - // If we have a parent, then assign chlid's parent to point to our parent. + // If we have a parent, then assign child's parent to point to our parent. if (!parent_.empty()) { child_[0]->parent_[0] = parent_[0]; } else { diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h index cc46f33ed1f..25d6fd0156c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h @@ -142,7 +142,7 @@ class TreePass : public Pass { /// \brief Derived classes may implement the runOnTree function to implement tree transformation. /// "modified" flag needs to be set to true if tree is modified during the pass execution. /// \param[inout] tree The tree to operate on. - /// \param[inout] Indicate of the tree was modified. + /// \param[inout] Indicate if the tree was modified. /// \return Status The error code return virtual Status RunOnTree(std::shared_ptr root_ir, bool *modified) { return Status::OK(); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.cc b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.cc index 3c0f3f9e93b..ec612eda49d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.cc @@ -44,11 +44,6 @@ Status GetterPass::GetterNodes::RunOnNode(std::shared_ptr node, bool *mod return Status::OK(); } -Status GetterPass::GetterNodes::PreRunOnNode(std::shared_ptr node, bool *modified) { - if (type_ == kOutputShapeAndType) nodes_to_remove_.push_back(node); - return Status::OK(); -} - #ifdef ENABLE_PYTHON Status GetterPass::GetterNodes::RunOnNode(std::shared_ptr node, bool *modified) { if (type_ == kOutputShapeAndType) nodes_to_remove_.push_back(node); diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.h index 798a7b23ee5..51d738e32fc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/getter_pass.h @@ -59,8 +59,6 @@ class GetterPass : public TreePass { Status RunOnNode(std::shared_ptr node, bool *modified) override; Status RunOnNode(std::shared_ptr node, bool *modified) override; Status RunOnNode(std::shared_ptr node, bool *modified) override; - // whether this is Run or PreRun does not matter here, however, Only Accept() is defined in ConcatOp - Status PreRunOnNode(std::shared_ptr node, bool *modified) override; #ifdef ENABLE_PYTHON Status RunOnNode(std::shared_ptr node, bool *modified) override; diff --git a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.cc b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.cc index 6e08a44dc49..1dd225b4e79 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.cc @@ -127,7 +127,7 @@ Status TreeAdapter::Compile(std::shared_ptr input_ir, int32_t num_e MS_LOG(INFO) << "Input plan:" << '\n' << *input_ir << '\n'; // Copy the input IR tree and insert under the root node - // Create a root node to host the input IR tree + // Create a root node to host the input IR tree, the deepcopied tree will be passed to optimization pass auto root_ir = std::make_shared(input_ir->DeepCopy(), num_epochs); MS_LOG(INFO) << "Plan before PrePass:" << '\n' << *root_ir << '\n'; @@ -149,6 +149,7 @@ Status TreeAdapter::Compile(std::shared_ptr input_ir, int32_t num_e // Build the Execution tree from the child of the root node std::shared_ptr root_op; + // input_ir is the ir node before the deepcopy. // We will replace input_ir with root_ir->Children()[0] once IR optimizer is in RETURN_IF_NOT_OK(BuildExecutionTree(input_ir, &root_op)); RETURN_IF_NOT_OK(tree_->AssignRoot(root_op)); diff --git a/tests/ut/cpp/dataset/CMakeLists.txt b/tests/ut/cpp/dataset/CMakeLists.txt index 4a6ff81abc9..498959fc3f4 100644 --- a/tests/ut/cpp/dataset/CMakeLists.txt +++ b/tests/ut/cpp/dataset/CMakeLists.txt @@ -1,6 +1,7 @@ include(GoogleTest) SET(DE_UT_SRCS + execute_test.cc album_op_test.cc arena_test.cc auto_contrast_op_test.cc @@ -17,7 +18,6 @@ SET(DE_UT_SRCS c_api_dataset_coco_test.cc c_api_dataset_config_test.cc c_api_dataset_csv_test.cc - c_api_dataset_ir_node_test.cc c_api_dataset_iterator_test.cc c_api_dataset_manifest_test.cc c_api_dataset_minddata_test.cc @@ -58,7 +58,6 @@ SET(DE_UT_SRCS distributed_sampler_test.cc epoch_ctrl_op_test.cc equalize_op_test.cc - execute_test.cc execution_tree_test.cc fill_op_test.cc global_context_test.cc @@ -66,6 +65,7 @@ SET(DE_UT_SRCS image_folder_op_test.cc image_process_test.cc interrupt_test.cc + ir_node_test.cc jieba_tokenizer_op_test.cc main_test.cc map_op_test.cc diff --git a/tests/ut/cpp/dataset/c_api_dataset_ir_node_test.cc b/tests/ut/cpp/dataset/ir_node_test.cc similarity index 97% rename from tests/ut/cpp/dataset/c_api_dataset_ir_node_test.cc rename to tests/ut/cpp/dataset/ir_node_test.cc index fba70d7cee5..513de18a330 100644 --- a/tests/ut/cpp/dataset/c_api_dataset_ir_node_test.cc +++ b/tests/ut/cpp/dataset/ir_node_test.cc @@ -16,7 +16,6 @@ #include #include -#include "minddata/dataset/core/client.h" #include "common/common.h" #include "gtest/gtest.h" @@ -24,14 +23,10 @@ #include "minddata/dataset/engine/opt/pre/getter_pass.h" using namespace mindspore::dataset; -using mindspore::LogStream; -using mindspore::MsLogLevel::INFO; class MindDataTestIRNodes : public UT::DatasetOpTesting { public: MindDataTestIRNodes() = default; - void SetUp() override { GlobalInit(); } - // compare the ptr of the nodes in two trees, used to test the deep copy of nodes, will return error code // if (ptr1 == ptr2) does not equal to flag or the two tree has different structures (or node names are not the same) Status CompareTwoTrees(std::shared_ptr root1, std::shared_ptr root2, bool flag) {