提交 a2a90800 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!2053 add check if there is no data

Merge pull request !2053 from yanghaitao/yht_no_data
......@@ -116,6 +116,11 @@ Status ImageFolderOp::PrescanMasterEntry(const std::string &filedir) {
}
image_label_pairs_.shrink_to_fit();
num_rows_ = image_label_pairs_.size();
if (num_rows_ == 0) {
RETURN_STATUS_UNEXPECTED(
"There is no valid data matching the dataset API ImageFolderDatasetV2.Please check file path or dataset "
"API validation first.");
}
// free memory of two queues used for pre-scan
folder_name_queue_->Reset();
image_name_queue_->Reset();
......
......@@ -350,6 +350,11 @@ Status MnistOp::ParseMnistData() {
}
image_label_pairs_.shrink_to_fit();
num_rows_ = image_label_pairs_.size();
if (num_rows_ == 0) {
RETURN_STATUS_UNEXPECTED(
"There is no valid data matching the dataset API MnistDataset.Please check file path or dataset API "
"validation first.");
}
return Status::OK();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册