Browse Source

add code

tags/v0.2.0-alpha
xulei2020 6 years ago
parent
commit
b5b506c4c3
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      mindspore/ccsrc/dataset/engine/datasetops/filter_op.cc
  2. +5
    -2
      mindspore/ccsrc/dataset/engine/datasetops/filter_op.h

+ 2
- 2
mindspore/ccsrc/dataset/engine/datasetops/filter_op.cc View File

@@ -75,7 +75,7 @@ Status FilterOp::EoeReceived(int32_t) { return Status::OK(); }

// Validating if each of the input_columns exists in the DataBuffer.
Status FilterOp::ValidateInColumns(const std::unordered_map<std::string, int32_t> &col_name_id_map,
std::vector<std::string> *input_columns) {
const std::vector<std::string> *input_columns) {
for (const auto &inCol : *input_columns) {
bool found = col_name_id_map.find(inCol) != col_name_id_map.end() ? true : false;
if (!found) {
@@ -202,7 +202,7 @@ Status FilterOp::Collector() {
}

// Private function for checking the column legality.
Status FilterOp::CheckColumns(const DataBuffer *in_buf, std::vector<std::string> *input_columns) {
Status FilterOp::CheckColumns(const DataBuffer *in_buf, const std::vector<std::string> *input_columns) {
int32_t num_rows = in_buf->NumRows();
int32_t num_cols = in_buf->NumCols();
if (num_rows == 0 || num_cols == 0) {


+ 5
- 2
mindspore/ccsrc/dataset/engine/datasetops/filter_op.h View File

@@ -100,6 +100,9 @@ class FilterOp : public ParallelOp {
FilterOp(const std::vector<std::string> &in_col_names, int32_t num_workers, int32_t op_queue_size,
py::function predicate_func);

// Destructor
~FilterOp() = default;

// Class functor operator () override.
// All dataset ops operate by launching a thread (see ExecutionTree),This class functor will
// provide the master loop that drives the logic for performing the work.
@@ -163,14 +166,14 @@ class FilterOp : public ParallelOp {
// @param input_columns The vector of input column names used in the current thread.
// @return Status The error code return.
Status ValidateInColumns(const std::unordered_map<std::string, int32_t> &col_name_id_map,
std::vector<std::string> *input_columns);
const std::vector<std::string> *input_columns);

// Private function for checking the column legality
// @param in_buf A raw pointer to the DataBuffer. A raw pointer is fine because this function does not manage memory
// and is not shared with other threads.
// @param[out] to_process_indices Indices of columns that will feed to predicate.
// @param input_columns The vector of input column names used in the current thread.
Status CheckColumns(const DataBuffer *in_buf, std::vector<std::string> *input_columns);
Status CheckColumns(const DataBuffer *in_buf, const std::vector<std::string> *input_columns);
};

} // namespace dataset


Loading…
Cancel
Save