Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
3ec19ca9
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3ec19ca9
编写于
4月 28, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
4月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
!793 More understandable error msg when number of rows is zero
Merge pull request !793 from yanghaitao/yht_err_msg_num_rows_zero
上级
64abbeaa
eb60ef00
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
58 addition
and
21 deletion
+58
-21
mindspore/ccsrc/dataset/engine/datasetops/source/celeba_op.cc
...spore/ccsrc/dataset/engine/datasetops/source/celeba_op.cc
+12
-6
mindspore/ccsrc/dataset/engine/datasetops/source/cifar_op.cc
mindspore/ccsrc/dataset/engine/datasetops/source/cifar_op.cc
+12
-3
mindspore/ccsrc/dataset/engine/datasetops/source/image_folder_op.cc
...ccsrc/dataset/engine/datasetops/source/image_folder_op.cc
+6
-2
mindspore/ccsrc/dataset/engine/datasetops/source/manifest_op.cc
...ore/ccsrc/dataset/engine/datasetops/source/manifest_op.cc
+10
-4
mindspore/ccsrc/dataset/engine/datasetops/source/mnist_op.cc
mindspore/ccsrc/dataset/engine/datasetops/source/mnist_op.cc
+6
-2
mindspore/ccsrc/dataset/engine/datasetops/source/text_file_op.cc
...re/ccsrc/dataset/engine/datasetops/source/text_file_op.cc
+3
-1
mindspore/ccsrc/dataset/engine/datasetops/source/tf_reader_op.cc
...re/ccsrc/dataset/engine/datasetops/source/tf_reader_op.cc
+3
-1
mindspore/ccsrc/dataset/engine/datasetops/source/voc_op.cc
mindspore/ccsrc/dataset/engine/datasetops/source/voc_op.cc
+6
-2
未找到文件。
mindspore/ccsrc/dataset/engine/datasetops/source/celeba_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -33,8 +33,8 @@ CelebAOp::Builder::Builder() : builder_decode_(false), builder_sampler_(nullptr)
}
Status
CelebAOp
::
Builder
::
Build
(
std
::
shared_ptr
<
CelebAOp
>
*
op
)
{
MS_LOG
(
INFO
)
<<
"Celeba dataset directory is "
<<
builder_dir_
.
c_str
()
<<
"."
;
MS_LOG
(
INFO
)
<<
"Celeba dataset type is "
<<
builder_dataset_type_
.
c_str
()
<<
"."
;
MS_LOG
(
DEBUG
)
<<
"Celeba dataset directory is "
<<
builder_dir_
.
c_str
()
<<
"."
;
MS_LOG
(
DEBUG
)
<<
"Celeba dataset type is "
<<
builder_dataset_type_
.
c_str
()
<<
"."
;
RETURN_IF_NOT_OK
(
SanityCheck
());
if
(
builder_sampler_
==
nullptr
)
{
builder_sampler_
=
std
::
make_shared
<
SequentialSampler
>
();
...
...
@@ -240,9 +240,11 @@ Status CelebAOp::ParseImageAttrInfo() {
num_rows_exact_
=
image_labels_vec_
.
size
();
num_samples_
=
(
num_samples_
==
0
||
num_samples_
>
num_rows_exact_
)
?
num_rows_exact_
:
num_samples_
;
if
(
num_rows_exact_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Number of rows in celeba dataset is zero"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API CelebADataset.Please check file path or dataset API "
"validation first."
);
}
MS_LOG
(
INFO
)
<<
"Celeba dataset rows number is "
<<
num_rows_exact_
<<
"."
;
MS_LOG
(
DEBUG
)
<<
"Celeba dataset rows number is "
<<
num_rows_exact_
<<
"."
;
return
Status
::
OK
();
}
...
...
@@ -267,7 +269,9 @@ std::vector<std::string> CelebAOp::Split(const std::string &line) {
// Derived from RandomAccessOp
Status
CelebAOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_samples_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumSample not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API CelebADataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -275,7 +279,9 @@ Status CelebAOp::GetNumSamples(int64_t *num) const {
Status
CelebAOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_exact_
==
0
)
{
return
Status
(
StatusCode
::
kUnexpectedError
,
__LINE__
,
__FILE__
,
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API CelebADataset.Please check file path or dataset API "
"validation first."
);
}
*
num
=
num_rows_exact_
;
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/cifar_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -247,7 +247,10 @@ Status CifarOp::InitSampler() {
// Derived from RandomAccessOp
Status
CifarOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
std
::
string
api
=
cifar_type_
==
kCifar10
?
"Cifar10Dataset"
:
"Cifar100Dataset"
;
std
::
string
err_msg
=
"There is no valid data matching the dataset API "
+
api
+
".Please check file path or dataset API validation first."
;
RETURN_STATUS_UNEXPECTED
(
err_msg
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -256,7 +259,10 @@ Status CifarOp::GetNumSamples(int64_t *num) const {
// Derived from RandomAccessOp
Status
CifarOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
std
::
string
api
=
cifar_type_
==
kCifar10
?
"Cifar10Dataset"
:
"Cifar100Dataset"
;
std
::
string
err_msg
=
"There is no valid data matching the dataset API "
+
api
+
".Please check file path or dataset API validation first."
;
RETURN_STATUS_UNEXPECTED
(
err_msg
);
}
(
*
num
)
=
num_rows_
;
return
Status
::
OK
();
...
...
@@ -389,7 +395,10 @@ Status CifarOp::ParseCifarData() {
num_rows_
=
cifar_image_label_pairs_
.
size
();
num_samples_
=
(
num_samples_
==
0
||
num_samples_
>
num_rows_
)
?
num_rows_
:
num_samples_
;
if
(
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Init Cifar failed, not a single row read from dataset!"
);
std
::
string
api
=
cifar_type_
==
kCifar10
?
"Cifar10Dataset"
:
"Cifar100Dataset"
;
std
::
string
err_msg
=
"There is no valid data matching the dataset API "
+
api
+
".Please check file path or dataset API validation first."
;
RETURN_STATUS_UNEXPECTED
(
err_msg
);
}
cifar_raw_data_block_
->
Reset
();
return
Status
::
OK
();
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/image_folder_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -265,7 +265,9 @@ Status ImageFolderOp::InitSampler() {
// Derived from RandomAccessOp
Status
ImageFolderOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_samples_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API ImageFolderDatasetV2.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -274,7 +276,9 @@ Status ImageFolderOp::GetNumSamples(int64_t *num) const {
// Derived from RandomAccessOp
Status
ImageFolderOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API ImageFolderDatasetV2.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_rows_
;
return
Status
::
OK
();
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/manifest_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -261,7 +261,9 @@ Status ManifestOp::InitSampler() {
// Derived from RandomAccessOp
Status
ManifestOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API ManifestDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -270,7 +272,9 @@ Status ManifestOp::GetNumSamples(int64_t *num) const {
// Derived from RandomAccessOp
Status
ManifestOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API ManifestDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_rows_
;
return
Status
::
OK
();
...
...
@@ -279,7 +283,7 @@ Status ManifestOp::GetNumRowsInDataset(int64_t *num) const {
// Derived from RandomAccessOp
Status
ManifestOp
::
GetClassIds
(
std
::
map
<
int32_t
,
std
::
vector
<
int64_t
>>
*
cls_ids
)
const
{
if
(
cls_ids
==
nullptr
||
!
cls_ids
->
empty
()
||
image_labelname_
.
empty
())
{
RETURN_STATUS_UNEXPECTED
(
"
Number rows is 0
"
);
RETURN_STATUS_UNEXPECTED
(
"
Class indexing is invalid.
"
);
}
for
(
size_t
i
=
0
;
i
<
image_labelname_
.
size
();
i
++
)
{
...
...
@@ -395,7 +399,9 @@ Status ManifestOp::CountDatasetInfo() {
num_rows_
=
static_cast
<
int64_t
>
(
image_labelname_
.
size
());
num_samples_
=
(
num_samples_
==
0
||
num_samples_
>
num_rows_
)
?
num_rows_
:
num_samples_
;
if
(
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Number of rows is 0"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API ManifestDataset.Please check file path or dataset API "
"validation first."
);
}
return
Status
::
OK
();
}
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/mnist_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -212,7 +212,9 @@ Status MnistOp::InitSampler() {
// Derived from RandomAccessOp
Status
MnistOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API MnistDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -436,7 +438,9 @@ Status MnistOp::CountTotalRows(const std::string &dir, int64_t numSamples, int64
// Derived from RandomAccessOp
Status
MnistOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API MnistDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_rows_
;
return
Status
::
OK
();
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/text_file_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -443,7 +443,9 @@ Status TextFileOp::CalculateNumRowsPerShard() {
all_num_rows_
+=
count
;
}
if
(
all_num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Number of rows can not be zero"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API TextFileDataset.Please check file path or dataset API "
"validation first."
);
}
num_rows_per_shard_
=
static_cast
<
int64_t
>
(
std
::
ceil
(
all_num_rows_
*
1.0
/
num_devices_
));
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/tf_reader_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -198,7 +198,9 @@ Status TFReaderOp::CalculateNumRowsPerShard() {
}
num_rows_per_shard_
=
static_cast
<
int64_t
>
(
std
::
ceil
(
num_rows_
*
1.0
/
num_devices_
));
if
(
num_rows_per_shard_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Number of rows can not be zero"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API TFRecordDataset.Please check file path or dataset API "
"validation first."
);
}
return
Status
::
OK
();
}
...
...
mindspore/ccsrc/dataset/engine/datasetops/source/voc_op.cc
浏览文件 @
3ec19ca9
...
...
@@ -147,7 +147,9 @@ Status VOCOp::Reset() {
Status
VOCOp
::
GetNumSamples
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API VOCDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_samples_
;
return
Status
::
OK
();
...
...
@@ -261,7 +263,9 @@ Status VOCOp::ReadImageToTensor(const std::string &path, const ColDescriptor &co
// Derived from RandomAccessOp
Status
VOCOp
::
GetNumRowsInDataset
(
int64_t
*
num
)
const
{
if
(
num
==
nullptr
||
num_rows_
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"NumRow not set"
);
RETURN_STATUS_UNEXPECTED
(
"There is no valid data matching the dataset API VOCDataset.Please check file path or dataset API "
"validation first."
);
}
(
*
num
)
=
num_rows_
;
return
Status
::
OK
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录