forked from mindspore-Ecosystem/mindspore
!9138 Address left over comments from PR8802
From: @ziruiwu Reviewed-by: @nsyca,@robingrosman Signed-off-by: @nsyca
This commit is contained in:
commit
c1002d2eb4
|
@ -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 {
|
||||
|
|
|
@ -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<DatasetNode> root_ir, bool *modified) { return Status::OK(); }
|
||||
|
||||
|
|
|
@ -44,11 +44,6 @@ Status GetterPass::GetterNodes::RunOnNode(std::shared_ptr<MapOp> node, bool *mod
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
Status GetterPass::GetterNodes::PreRunOnNode(std::shared_ptr<ConcatOp> 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<FilterOp> node, bool *modified) {
|
||||
if (type_ == kOutputShapeAndType) nodes_to_remove_.push_back(node);
|
||||
|
|
|
@ -59,8 +59,6 @@ class GetterPass : public TreePass {
|
|||
Status RunOnNode(std::shared_ptr<SkipOp> node, bool *modified) override;
|
||||
Status RunOnNode(std::shared_ptr<TakeOp> node, bool *modified) override;
|
||||
Status RunOnNode(std::shared_ptr<MapOp> 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<ConcatOp> node, bool *modified) override;
|
||||
|
||||
#ifdef ENABLE_PYTHON
|
||||
Status RunOnNode(std::shared_ptr<FilterOp> node, bool *modified) override;
|
||||
|
|
|
@ -127,7 +127,7 @@ Status TreeAdapter::Compile(std::shared_ptr<DatasetNode> 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<RootNode>(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<DatasetNode> input_ir, int32_t num_e
|
|||
|
||||
// Build the Execution tree from the child of the root node
|
||||
std::shared_ptr<DatasetOp> 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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#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<DatasetNode> root1, std::shared_ptr<DatasetNode> root2, bool flag) {
|
Loading…
Reference in New Issue