Browse Source

fix codedex + add docstring

pull/14814/head
mohammad 4 years ago
parent
commit
cc42b2c221
14 changed files with 31 additions and 16 deletions
  1. +2
    -2
      mindspore/ccsrc/minddata/dataset/api/iterator.cc
  2. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc
  3. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h
  4. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc
  5. +4
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h
  6. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc
  7. +4
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h
  8. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc
  9. +4
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h
  10. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc
  11. +4
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h
  12. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc
  13. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h
  14. +5
    -2
      mindspore/ccsrc/minddata/dataset/include/iterator.h

+ 2
- 2
mindspore/ccsrc/minddata/dataset/api/iterator.cc View File

@@ -84,7 +84,7 @@ Status Iterator::BuildAndLaunchTree(std::shared_ptr<Dataset> 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<MSTensorVec> *row) {
Status PullIterator::GetRows(int32_t num_rows, std::vector<MSTensorVec> *const row) {
for (int i = 0; i < num_rows; i++) {
std::vector<std::shared_ptr<dataset::Tensor>> md_row;
Status rc = pull_consumer_->GetNextAsVector(&md_row);
@@ -105,7 +105,7 @@ Status PullIterator::GetRows(int32_t num_rows, std::vector<MSTensorVec> *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<std::shared_ptr<dataset::Tensor>> md_row;
Status rc = pull_consumer_->GetNextAsVector(&md_row);


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc View File

@@ -40,7 +40,7 @@ std::vector<TensorRow> PullBasedIteratorConsumer::GetRows(int64_t num_rows) {
return rows;
}

Status PullBasedIteratorConsumer::GetNextAsVector(std::vector<TensorPtr> *out) {
Status PullBasedIteratorConsumer::GetNextAsVector(std::vector<TensorPtr> *const out) {
RETURN_UNEXPECTED_IF_NULL(out);
out->clear();



+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/consumers/pull_based_tree_consumer.h View File

@@ -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<TensorPtr> *out);
Status GetNextAsVector(std::vector<TensorPtr> *const out);

/// Returns the next row in as a map
/// \param[out] out std::map of string to Tensor


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc View File

@@ -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<TensorQTable> table = std::make_unique<TensorQTable>();
child_iterator_ = std::make_unique<ChildIterator>(this, 0, 0);
int32_t cur_batch_size = 0;


+ 4
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h View File

@@ -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.


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc View File

@@ -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);
}


+ 4
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h View File

@@ -127,7 +127,10 @@ class DatasetOp : public std::enable_shared_from_this<DatasetOp> {
/// \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


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc View File

@@ -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));


+ 4
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h View File

@@ -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


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.cc View File

@@ -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());


+ 4
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/album_op.h View File

@@ -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


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.cc View File

@@ -54,7 +54,7 @@ Status TreeAdapterLite::BuildTree(std::shared_ptr<DatasetNode> 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();


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/tree_adapter_lite.h View File

@@ -40,7 +40,7 @@ class TreeAdapterLite {
Status BuildTree(std::shared_ptr<DatasetNode> root_ir);

// Get rows equal to num_rows
Status GetNextRow(TensorRow *row);
Status GetNextRow(TensorRow *const row);

std::unordered_map<std::string, int32_t> GetColumnNameMap() const { return tree_->root()->column_name_id_map(); }



+ 5
- 2
mindspore/ccsrc/minddata/dataset/include/iterator.h View File

@@ -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<MSTensorVec> *row);
Status GetRows(int32_t num_rows, std::vector<MSTensorVec> *const row);

/// \brief Method for building and launching the pipeline.
/// \note Consider making this function protected.


Loading…
Cancel
Save