Browse Source

!8053 Revert changes to weighted_random_sampler in PR7866

Merge pull request !8053 from ZiruiWu/revert_some_changes_in_7866
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
c8e2b043aa
1 changed files with 0 additions and 10 deletions
  1. +0
    -10
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc

+ 0
- 10
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc View File

@@ -49,16 +49,6 @@ Status WeightedRandomSampler::InitSampler() {
"Invalid parameter, samples_per_buffer must be greater than 0, but got " +
std::to_string(samples_per_buffer_) + ".\n");

CHECK_FAIL_RETURN_UNEXPECTED(weights_.size() != 0, "Invalid parameter, weights size must not be 0.\n");
int32_t zero_elem = 0;
for (auto &elem : weights_) {
CHECK_FAIL_RETURN_UNEXPECTED(elem >= 0.0, "Invalid parameter, weights must not contain negative number, but got " +
std::to_string(elem) + ".\n");
if (elem == 0.0) zero_elem++;
}
CHECK_FAIL_RETURN_UNEXPECTED(zero_elem != weights_.size(),
"Invalid parameter, elements of weights must not be all zero.\n");

if (weights_.size() > static_cast<size_t>(num_rows_)) {
return Status(StatusCode::kUnexpectedError, __LINE__, __FILE__,
"Invalid parameter, size of sample weights must be less than or equal to num of data, "


Loading…
Cancel
Save