Browse Source

!15417 [MD] fix bug in saving mindrecord when path is relative.

From: @liyong126
Reviewed-by: @liucunwei,@jonyguo
Signed-off-by: @liucunwei
pull/15417/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
63da26b4ba
2 changed files with 6 additions and 5 deletions
  1. +2
    -1
      mindspore/ccsrc/minddata/dataset/engine/consumers/tree_consumer.cc
  2. +4
    -4
      mindspore/ccsrc/minddata/mindrecord/meta/shard_schema.cc

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

@@ -181,7 +181,8 @@ Status SaveToDisk::ValidateParams() {
MS_LOG(ERROR) << err;
RETURN_STATUS_SYNTAX_ERROR(err);
}
if (access(dir.ParentPath().c_str(), R_OK) == -1) {
auto parent_path = dir.ParentPath();
if (!parent_path.empty() && access(common::SafeCStr(parent_path), R_OK) == -1) {
std::string err_msg = "CreateSaver failed, no access to specified dataset path: " + dataset_path_;
MS_LOG(ERROR) << err_msg;
RETURN_STATUS_SYNTAX_ERROR(err_msg);


+ 4
- 4
mindspore/ccsrc/minddata/mindrecord/meta/shard_schema.cc View File

@@ -79,20 +79,20 @@ std::vector<std::string> Schema::PopulateBlobFields(json schema) {

bool Schema::ValidateNumberShape(const json &it_value) {
if (it_value.find("shape") == it_value.end()) {
MS_LOG(ERROR) << "%s supports shape only." << it_value["type"].dump();
MS_LOG(ERROR) << it_value["type"].dump() << " supports shape only.";
return false;
}

auto shape = it_value["shape"];
if (!shape.is_array()) {
MS_LOG(ERROR) << "%s shape format is wrong." << it_value["type"].dump();
MS_LOG(ERROR) << "Shape " << it_value["type"].dump() << ", format is wrong.";
return false;
}

int num_negtive_one = 0;
for (const auto &i : shape) {
if (i == 0 || i < -1) {
MS_LOG(ERROR) << "Shape %s, number is wrong." << it_value["shape"].dump();
MS_LOG(ERROR) << "Shape " << it_value["shape"].dump() << ", dimension is wrong.";
return false;
}
if (i == -1) {
@@ -101,7 +101,7 @@ bool Schema::ValidateNumberShape(const json &it_value) {
}

if (num_negtive_one > 1) {
MS_LOG(ERROR) << "Shape %s, have at most 1 variable-length dimension." << it_value["shape"].dump();
MS_LOG(ERROR) << "Shape " << it_value["shape"].dump() << ", have at most 1 variable-length dimension.";
return false;
}



Loading…
Cancel
Save