diff --git a/mindspore/ccsrc/minddata/dataset/api/iterator.cc b/mindspore/ccsrc/minddata/dataset/api/iterator.cc index 4db49962f4..cf0d763442 100644 --- a/mindspore/ccsrc/minddata/dataset/api/iterator.cc +++ b/mindspore/ccsrc/minddata/dataset/api/iterator.cc @@ -84,7 +84,7 @@ Status Iterator::BuildAndLaunchTree(std::shared_ptr ds, int32_t num_epo PullIterator::PullIterator() : pull_consumer_(nullptr) {} // Get the next row from the data pipeline. -Status PullIterator::GetRows(int32_t num_rows, std::vector *row) { +Status PullIterator::GetRows(int32_t num_rows, std::vector *const row) { for (int i = 0; i < num_rows; i++) { std::vector> md_row; Status rc = pull_consumer_->GetNextAsVector(&md_row); @@ -105,7 +105,7 @@ Status PullIterator::GetRows(int32_t num_rows, std::vector *row) { return Status::OK(); } -Status PullIterator::GetNextRow(MSTensorVec *row) { +Status PullIterator::GetNextRow(MSTensorVec *const row) { CHECK_FAIL_RETURN_UNEXPECTED(pull_consumer_ != nullptr, "Consumer is nullptr."); std::vector> md_row; Status rc = pull_consumer_->GetNextAsVector(&md_row); diff --git a/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc b/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc index 8f23c80eb8..d6da54eb30 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc @@ -40,7 +40,7 @@ std::vector PullBasedIteratorConsumer::GetRows(int64_t num_rows) { return rows; } -Status PullBasedIteratorConsumer::GetNextAsVector(std::vector *out) { +Status PullBasedIteratorConsumer::GetNextAsVector(std::vector *const out) { RETURN_UNEXPECTED_IF_NULL(out); out->clear(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h b/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h index ac7ef6a1be..096b65d39c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h +++ b/mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h @@ -49,7 +49,7 @@ class PullBasedIteratorConsumer { /// Returns the next row in a vector format /// \param[out] out std::vector of Tensors /// \return Status error code - Status GetNextAsVector(std::vector *out); + Status GetNextAsVector(std::vector *const out); /// Returns the next row in as a map /// \param[out] out std::map of string to Tensor diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc index 34e42a6965..c1d4a3076b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc @@ -566,7 +566,7 @@ int64_t BatchOp::GetTreeBatchSize() { return start_batch_size_; } -Status BatchOp::GetNextRowPullMode(TensorRow *row) { +Status BatchOp::GetNextRowPullMode(TensorRow *const row) { std::unique_ptr table = std::make_unique(); child_iterator_ = std::make_unique(this, 0, 0); int32_t cur_batch_size = 0; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h index 54dde54583..bbfab37dbe 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h @@ -256,7 +256,10 @@ class BatchOp : public ParallelOp { // @return Status The status code returned Status LaunchThreadsAndInitOp(); - Status GetNextRowPullMode(TensorRow *row) override; + /// \brief Gets the next row + /// \param row[out] - Fetched TensorRow + /// \return Status The status code returned + Status GetNextRowPullMode(TensorRow *const row) override; #ifdef ENABLE_PYTHON // Invoke batch size function with current BatchInfo to generate batch size. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc index 67a508a31b..2d46dd7325 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc @@ -252,7 +252,7 @@ void DatasetOp::Print(std::ostream &out, bool show_all) const { } } -Status DatasetOp::GetNextRowPullMode(TensorRow *row) { +Status DatasetOp::GetNextRowPullMode(TensorRow *const row) { RETURN_UNEXPECTED_IF_NULL(child_[0]); return child_[0]->GetNextRowPullMode(row); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h index 5b4be48c8c..15f6bc5b88 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h @@ -127,7 +127,10 @@ class DatasetOp : public std::enable_shared_from_this { /// \param show_all - A bool to control if you want to show all info or just a summary virtual void Print(std::ostream &out, bool show_all) const; - virtual Status GetNextRowPullMode(TensorRow *row); + /// \brief Gets the next row + /// \param row[out] - Fetched TensorRow + /// \return Status The status code returned + virtual Status GetNextRowPullMode(TensorRow *const row); /// \brief << Stream output operator overload /// \notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc index f3296595b3..bba87f030f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc @@ -145,7 +145,7 @@ Status ProjectOp::ComputeColMap() { return Status::OK(); } -Status ProjectOp::GetNextRowPullMode(TensorRow *row) { +Status ProjectOp::GetNextRowPullMode(TensorRow *const row) { ComputeColMap(); TensorRow new_row; RETURN_IF_NOT_OK(child_[0]->GetNextRowPullMode(&new_row)); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h index 5b530c906e..db0845033c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h @@ -101,7 +101,10 @@ class ProjectOp : public PipelineOp { // @return Status The status code returned Status EofReceived(int32_t worker_id) override; - Status GetNextRowPullMode(TensorRow *row) override; + /// \brief Gets the next row + /// \param row[out] - Fetched TensorRow + /// \return Status The status code returned + Status GetNextRowPullMode(TensorRow *const row) override; // Op name getter // @return Name of the current Op 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 1fe6ae1e92..54467cf623 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc @@ -483,7 +483,7 @@ Status AlbumOp::ComputeColMap() { return Status::OK(); } -Status AlbumOp::GetNextRowPullMode(TensorRow *row) { +Status AlbumOp::GetNextRowPullMode(TensorRow *const row) { if (image_rows_.empty()) PrescanEntry(); if (sample_ids_ == nullptr) { RETURN_IF_NOT_OK(this->InitSampler()); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h index 91bc88cf9f..d352a2c690 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h @@ -257,7 +257,10 @@ class AlbumOp : public MappableLeafOp { /// \return Status The status code returned Status LaunchThreadsAndInitOp() override; - Status GetNextRowPullMode(TensorRow *row) override; + /// \brief Gets the next row + /// \param row[out] - Fetched TensorRow + /// \return Status The status code returned + Status GetNextRowPullMode(TensorRow *const row) override; /// Private function for computing the assignment of the column name map. /// \return Status The status code returned diff --git a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc index 0bef88eb1d..d8d1a9b0e4 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc @@ -54,7 +54,7 @@ Status TreeAdapterLite::BuildTree(std::shared_ptr root_ir) { return Status::OK(); } -Status TreeAdapterLite::GetNextRow(TensorRow *row) { +Status TreeAdapterLite::GetNextRow(TensorRow *const row) { RETURN_UNEXPECTED_IF_NULL(root_); RETURN_IF_NOT_OK(root_->GetNextRowPullMode(row)); return Status::OK(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h index c42da20718..2fe54c488d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h +++ b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h @@ -40,7 +40,7 @@ class TreeAdapterLite { Status BuildTree(std::shared_ptr root_ir); // Get rows equal to num_rows - Status GetNextRow(TensorRow *row); + Status GetNextRow(TensorRow *const row); std::unordered_map GetColumnNameMap() const { return tree_->root()->column_name_id_map(); } diff --git a/mindspore/ccsrc/minddata/dataset/include/iterator.h b/mindspore/ccsrc/minddata/dataset/include/iterator.h index 9f080f3206..9a2a7b9758 100644 --- a/mindspore/ccsrc/minddata/dataset/include/iterator.h +++ b/mindspore/ccsrc/minddata/dataset/include/iterator.h @@ -137,11 +137,14 @@ class PullIterator : public Iterator { /// \brief Constructor PullIterator(); + /// \brief Destructor + ~PullIterator() = default; + /// \brief Function to get next row from the data pipeline. /// \note Type of return data is a vector(without column name). /// \param[out] row - the output tensor row. /// \return Returns true if no error encountered else false. - Status GetNextRow(MSTensorVec *row) override; + Status GetNextRow(MSTensorVec *const row) override; /// \brief Function to get specified rows from the data pipeline. /// \note Type of return data is a vector(without column name). @@ -149,7 +152,7 @@ class PullIterator : public Iterator { /// \param[in] num_rows - the number of rows to fetch. /// \param[out] row - the output tensor row. /// \return Returns true if no error encountered else false. - Status GetRows(int32_t num_rows, std::vector *row); + Status GetRows(int32_t num_rows, std::vector *const row); /// \brief Method for building and launching the pipeline. /// \note Consider making this function protected.