Fix the error is reported when the file name is directly transferred

This commit is contained in:
liu-yongqi-63 2022-03-28 16:46:01 +08:00
parent 46a614d37a
commit b125369f1e
5 changed files with 13 additions and 5 deletions

View File

@ -9,6 +9,7 @@ if(ENABLE_GITEE_EULER)
set(ICU4C_SRC "${TOP_DIR}/build/mindspore/_deps/icu4c-src/icu4c")
set(ICU4C_TAR_SRC "${TOP_DIR}/build/mindspore/_deps/icu4c-src")
__download_pkg_with_git(icu4c ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND mkdir ${ICU4C_SRC})
execute_process(COMMAND tar -xf ${ICU4C_TAR_SRC}/icu4c-69_1-src.tgz --strip-components 1 -C ${ICU4C_SRC})
else()
if(ENABLE_GITEE)

View File

@ -10,7 +10,7 @@ mindspore.dataset.DIV2KDataset
**参数:**
- **dataset_dir** (str) - 包含数据集文件的根目录路径。
- **usage** (str, 可选) - 指定数据集的子集。可取值为'train'、'valid'或'all'。默认值:'train',全部样本图片
- **usage** (str, 可选) - 指定数据集的子集。可取值为'train'、'valid'或'all'。默认值:'train'。
- **downgrade** (str, 可选) - 指定数据集的下采样的模式,可取值为'bicubic'、'unknown'、'mild'、'difficult'或'wild'。默认值:'bicubic'。
- **scale** (str, 可选) - 指定数据集的缩放尺度。当参数 `downgrade` 取值为'bicubic'时此参数可以取值为2、3、4、8。
当参数 `downgrade` 取值为'unknown'时此参数可以取值为2、3、4。当参数 `downgrade` 取值为'mild'、'difficult'、'wild'时此参数仅可以取值为4。默认值2。

View File

@ -389,6 +389,9 @@ Status SaveToDisk::ValidateParams() {
LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err);
}
std::string real_path;
if (dir.ParentPath().empty()) {
dir = Path(".") / dir;
}
if (Path::RealPath(dir.ParentPath(), real_path).IsError()) {
std::string err_msg = "SaveToDisk failed, can not get real dataset path: " + dir.ParentPath();
LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg);
@ -513,7 +516,9 @@ Status SaveToDisk::CheckTensorRowShapes(const std::unordered_map<std::string, in
}
auto res = map_compare(*PreTensorRowShapes_ptr, CurrTensorRowShapes);
CHECK_FAIL_RETURN_UNEXPECTED(res,
"Error: besides dimension 0, other dimension shape is different from the previous's.");
"Tensor with dynamic shape do not currently support saving. Except for the shape of "
"dimension 0, the other dimension shapes must be fixed. "
"You can reshape the Tensor to a fixed shape before saving.");
return Status::OK();
}

View File

@ -669,8 +669,8 @@ Status ShardHeader::Initialize(const std::shared_ptr<ShardHeader> *header_ptr, c
uint64_t &schema_id) {
RETURN_UNEXPECTED_IF_NULL(header_ptr);
auto schema_ptr = Schema::Build("mindrecord", schema);
CHECK_FAIL_RETURN_UNEXPECTED(schema_ptr != nullptr,
"[Internal ERROR] Failed to build schema: " + schema.dump() + ".");
CHECK_FAIL_RETURN_UNEXPECTED(schema_ptr != nullptr, "[Internal ERROR] Failed to build schema: " + schema.dump() +
"." + "Check the [ERROR] logs before for more details.");
schema_id = (*header_ptr)->AddSchema(schema_ptr);
// create index
std::vector<std::pair<uint64_t, std::string>> id_index_fields;

View File

@ -561,6 +561,8 @@ def test_case_10():
d1 = ds.GeneratorDataset(generator_dynamic_2d_1, ["data"], shuffle=False)
with pytest.raises(Exception, match=
"Error: besides dimension 0, other dimension shape is different from the previous's"):
"Tensor with dynamic shape do not currently support saving. Except for the shape of "
"dimension 0, the other dimension shapes must be fixed. "
"You can reshape the Tensor to a fixed shape before saving."):
d1.save(file_name_auto)
remove_file(file_name_auto)