Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
080bcda0
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看板
提交
080bcda0
编写于
3月 30, 2020
作者:
J
Jonathan Yan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace std::cout with MS_LOG in dataset unit test
Signed-off-by:
N
Jonathan Yan
<
jonathan.yan1@huawei.com
>
上级
062b744b
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
102 addition
and
66 deletion
+102
-66
tests/ut/cpp/dataset/arena_test.cc
tests/ut/cpp/dataset/arena_test.cc
+1
-1
tests/ut/cpp/dataset/btree_test.cc
tests/ut/cpp/dataset/btree_test.cc
+1
-1
tests/ut/cpp/dataset/cifar_op_test.cc
tests/ut/cpp/dataset/cifar_op_test.cc
+8
-4
tests/ut/cpp/dataset/circular_pool_test.cc
tests/ut/cpp/dataset/circular_pool_test.cc
+3
-3
tests/ut/cpp/dataset/image_folder_op_test.cc
tests/ut/cpp/dataset/image_folder_op_test.cc
+22
-11
tests/ut/cpp/dataset/manifest_op_test.cc
tests/ut/cpp/dataset/manifest_op_test.cc
+8
-4
tests/ut/cpp/dataset/map_op_test.cc
tests/ut/cpp/dataset/map_op_test.cc
+2
-2
tests/ut/cpp/dataset/memory_pool_test.cc
tests/ut/cpp/dataset/memory_pool_test.cc
+2
-2
tests/ut/cpp/dataset/mind_record_op_test.cc
tests/ut/cpp/dataset/mind_record_op_test.cc
+6
-6
tests/ut/cpp/dataset/mnist_op_test.cc
tests/ut/cpp/dataset/mnist_op_test.cc
+4
-2
tests/ut/cpp/dataset/normalize_op_test.cc
tests/ut/cpp/dataset/normalize_op_test.cc
+1
-1
tests/ut/cpp/dataset/one_hot_op_test.cc
tests/ut/cpp/dataset/one_hot_op_test.cc
+2
-2
tests/ut/cpp/dataset/path_test.cc
tests/ut/cpp/dataset/path_test.cc
+2
-2
tests/ut/cpp/dataset/queue_test.cc
tests/ut/cpp/dataset/queue_test.cc
+1
-1
tests/ut/cpp/dataset/random_crop_decode_resizeOp_test.cc
tests/ut/cpp/dataset/random_crop_decode_resizeOp_test.cc
+2
-2
tests/ut/cpp/dataset/stand_alone_samplers_test.cc
tests/ut/cpp/dataset/stand_alone_samplers_test.cc
+1
-1
tests/ut/cpp/dataset/status_test.cc
tests/ut/cpp/dataset/status_test.cc
+4
-4
tests/ut/cpp/dataset/task_manager_test.cc
tests/ut/cpp/dataset/task_manager_test.cc
+1
-1
tests/ut/cpp/dataset/tensor_test.cc
tests/ut/cpp/dataset/tensor_test.cc
+1
-1
tests/ut/cpp/dataset/type_cast_op_test.cc
tests/ut/cpp/dataset/type_cast_op_test.cc
+1
-1
tests/ut/cpp/mindrecord/ut_shard_operator_test.cc
tests/ut/cpp/mindrecord/ut_shard_operator_test.cc
+28
-14
tests/ut/cpp/runtest.sh
tests/ut/cpp/runtest.sh
+1
-0
未找到文件。
tests/ut/cpp/dataset/arena_test.cc
浏览文件 @
080bcda0
...
...
@@ -45,5 +45,5 @@ TEST_F(MindDataTestArena, TestALLFunction) {
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
{
mp
->
Deallocate
(
v
.
at
(
i
));
}
std
::
cout
<<
*
mp
;
MS_LOG
(
DEBUG
)
<<
*
mp
;
}
tests/ut/cpp/dataset/btree_test.cc
浏览文件 @
080bcda0
...
...
@@ -196,6 +196,6 @@ TEST_F(MindDataTestBPlusTree, Test3) {
EXPECT_EQ
(
it
.
value
(),
"b"
);
MS_LOG
(
INFO
)
<<
"Dump all the values using [] operator."
;
for
(
uint64_t
i
=
min
;
i
<=
max
;
i
++
)
{
std
::
cout
<<
ai
[
i
]
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
ai
[
i
]
<<
std
::
endl
;
}
}
tests/ut/cpp/dataset/cifar_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -81,7 +81,8 @@ TEST_F(MindDataTestCifarOp, TestSequentialSamplerCifar10) {
uint32_t
label
=
0
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
100
);
...
...
@@ -108,7 +109,8 @@ TEST_F(MindDataTestCifarOp, TestRandomSamplerCifar10) {
uint32_t
label
=
0
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
12
);
...
...
@@ -133,7 +135,8 @@ TEST_F(MindDataTestCifarOp, TestCifar10NumSample) {
uint32_t
label
=
0
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
100
);
...
...
@@ -159,8 +162,9 @@ TEST_F(MindDataTestCifarOp, TestSequentialSamplerCifar100) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"coarse_label"
]
->
GetItemAt
<
uint32_t
>
(
&
coarse
,
{});
tensor_map
[
"fine_label"
]
->
GetItemAt
<
uint32_t
>
(
&
fine
,
{});
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
" coarse:"
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
" coarse:"
<<
coarse
<<
" fine:"
<<
fine
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
100
);
...
...
tests/ut/cpp/dataset/circular_pool_test.cc
浏览文件 @
080bcda0
...
...
@@ -52,7 +52,7 @@ Status TestMem(MindDataTestCircularPool *tp, int32_t num_iterations) {
uint64_t
new_sz
=
dist
(
gen
);
std
::
string
str
=
"Allocate "
+
std
::
to_string
(
old_sz
)
+
" bytes of memory and then resize to "
+
std
::
to_string
(
new_sz
);
std
::
cout
<<
str
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
str
<<
std
::
endl
;
std
::
string
id
=
Services
::
GetUniqueID
();
void
*
p
;
RETURN_IF_NOT_OK
(
tp
->
mp_
->
Allocate
(
old_sz
,
&
p
));
...
...
@@ -76,9 +76,9 @@ TEST_F(MindDataTestCircularPool, TestALLFunction) {
vg_
.
CreateAsyncTask
(
"TestMem"
,
f
);
}
vg_
.
join_all
();
std
::
cout
<<
vg_
.
GetTaskErrorIfAny
()
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
vg_
.
GetTaskErrorIfAny
()
<<
std
::
endl
;
ASSERT_TRUE
(
vg_
.
GetTaskErrorIfAny
().
IsOk
());
CircularPool
*
cp
=
dynamic_cast
<
CircularPool
*>
(
mp_
.
get
());
std
::
cout
<<
*
cp
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
cp
<<
std
::
endl
;
}
tests/ut/cpp/dataset/image_folder_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -102,7 +102,8 @@ TEST_F(MindDataTestImageFolderSampler, TestSequentialImageFolderWithRepeat) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
res
[(
i
%
44
)
/
11
]
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
88
);
...
...
@@ -126,7 +127,8 @@ TEST_F(MindDataTestImageFolderSampler, TestRandomImageFolder) {
int32_t
label
=
0
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
44
);
...
...
@@ -155,7 +157,8 @@ TEST_F(MindDataTestImageFolderSampler, TestRandomSamplerImageFolder) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
res
[
i
]
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
12
);
...
...
@@ -185,8 +188,9 @@ TEST_F(MindDataTestImageFolderSampler, TestSequentialImageFolderWithRepeatBatch)
std
::
shared_ptr
<
Tensor
>
label
;
Create1DTensor
(
&
label
,
11
,
reinterpret_cast
<
unsigned
char
*>
(
res
[
i
%
4
]),
DataType
::
DE_INT32
);
EXPECT_TRUE
((
*
label
)
==
(
*
tensor_map
[
"label"
]));
std
::
cout
<<
"row: "
<<
i
++
<<
" "
<<
tensor_map
[
"image"
]
->
shape
()
<<
" (*label):"
<<
(
*
label
)
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
" "
<<
tensor_map
[
"image"
]
->
shape
()
<<
" (*label):"
<<
(
*
label
)
<<
" *tensor_map[label]: "
<<
*
tensor_map
[
"label"
]
<<
std
::
endl
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
8
);
...
...
@@ -282,7 +286,8 @@ TEST_F(MindDataTestImageFolderSampler, TestImageFolderClassIndex) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
label
==
res
[
i
/
11
]);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
22
);
...
...
@@ -308,7 +313,8 @@ TEST_F(MindDataTestImageFolderSampler, TestDistributedSampler) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_EQ
(
i
%
4
,
label
);
std
::
cout
<<
"row:"
<<
i
++
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
16
);
...
...
@@ -335,7 +341,8 @@ TEST_F(MindDataTestImageFolderSampler, TestPKSamplerImageFolder) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
res
[
i
]
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
12
);
...
...
@@ -360,7 +367,8 @@ TEST_F(MindDataTestImageFolderSampler, TestImageFolderNumSamples) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
0
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
22
);
...
...
@@ -392,7 +400,8 @@ TEST_F(MindDataTestImageFolderSampler, TestImageFolderDecode) {
EXPECT_TRUE
(
label
==
res
[
i
/
11
]);
EXPECT_TRUE
(
tensor_map
[
"image"
]
->
shape
()
==
TensorShape
({
2268
,
4032
,
3
}));
// verify shapes are correct after decode
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
20
);
...
...
@@ -442,7 +451,8 @@ TEST_F(MindDataTestImageFolderSampler, TestImageFolderSharding1) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_EQ
(
labels
[
i
],
label
);
std
::
cout
<<
"row:"
<<
i
++
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
5
);
...
...
@@ -470,7 +480,8 @@ TEST_F(MindDataTestImageFolderSampler, TestImageFolderSharding2) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
EXPECT_EQ
(
labels
[
i
],
label
);
std
::
cout
<<
"row:"
<<
i
++
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
11
);
...
...
tests/ut/cpp/dataset/manifest_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -76,7 +76,8 @@ TEST_F(MindDataTestManifest, TestSequentialManifestWithRepeat) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
res
[
i
]
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
4
);
...
...
@@ -134,7 +135,8 @@ TEST_F(MindDataTestManifest, MindDataTestManifestClassIndex) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
label
==
res
[
i
]);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
2
);
...
...
@@ -159,7 +161,8 @@ TEST_F(MindDataTestManifest, MindDataTestManifestNumSamples) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
0
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
4
);
...
...
@@ -184,7 +187,8 @@ TEST_F(MindDataTestManifest, MindDataTestManifestEval) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
0
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
1
);
...
...
tests/ut/cpp/dataset/map_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -697,7 +697,7 @@ TEST_F(MindDataTestMapOp, ImageFolder_Decode_Repeat_Resize) {
std
::
string
result
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
std
::
cout
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
EXPECT_TRUE
(
img_class
[(
i
%
44
)
/
11
]
==
label
);
// Dump all the image into string, to be used as a comparison later.
result
.
append
((
char
*
)
tensor_map
[
"image"
]
->
StartAddr
(),
(
int64_t
)
tensor_map
[
"image"
]
->
Size
());
...
...
@@ -743,7 +743,7 @@ TEST_F(MindDataTestMapOp, ImageFolder_Decode_Repeat_Resize) {
std
::
string
result2
;
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
int32_t
>
(
&
label
,
{});
std
::
cout
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row:"
<<
i
<<
"
\t
label:"
<<
label
<<
"
\n
"
;
EXPECT_TRUE
(
img_class
[(
i
%
44
)
/
11
]
==
label
);
result2
.
append
((
char
*
)
tensor_map
[
"image"
]
->
StartAddr
(),
(
int64_t
)
tensor_map
[
"image"
]
->
Size
());
di2
.
GetNextAsMap
(
&
tensor_map
);
...
...
tests/ut/cpp/dataset/memory_pool_test.cc
浏览文件 @
080bcda0
...
...
@@ -35,7 +35,7 @@ class MindDataTestMemoryPool : public UT::Common {
};
TEST_F
(
MindDataTestMemoryPool
,
DumpPoolInfo
)
{
std
::
cout
<<
*
(
std
::
dynamic_pointer_cast
<
CircularPool
>
(
mp_
))
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
(
std
::
dynamic_pointer_cast
<
CircularPool
>
(
mp_
))
<<
std
::
endl
;
}
TEST_F
(
MindDataTestMemoryPool
,
TestOperator1
)
{
...
...
@@ -72,5 +72,5 @@ TEST_F(MindDataTestMemoryPool, TestAllocator) {
std
::
shared_ptr
<
A
>
obj_a
=
std
::
allocate_shared
<
A
>
(
alloc
,
3
);
int
v
=
obj_a
->
val_a
();
ASSERT_EQ
(
v
,
3
);
std
::
cout
<<
*
(
std
::
dynamic_pointer_cast
<
CircularPool
>
(
mp_
))
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
(
std
::
dynamic_pointer_cast
<
CircularPool
>
(
mp_
))
<<
std
::
endl
;
}
tests/ut/cpp/dataset/mind_record_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -69,7 +69,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordBasic) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
my_tree
->
AssociateNode
(
my_mindrecord_op
);
...
...
@@ -140,7 +140,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordSample) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
my_tree
->
AssociateNode
(
my_mindrecord_op
);
...
...
@@ -211,7 +211,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordShuffle) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
my_tree
->
AssociateNode
(
my_mindrecord_op
);
...
...
@@ -285,7 +285,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordCategory) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
my_tree
->
AssociateNode
(
my_mindrecord_op
);
...
...
@@ -352,7 +352,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordRepeat) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
rc
=
my_tree
->
AssociateNode
(
my_mindrecord_op
);
EXPECT_TRUE
(
rc
.
IsOk
());
...
...
@@ -434,7 +434,7 @@ TEST_F(MindDataTestMindRecordOp, TestMindRecordBlockReaderRepeat) {
rc
=
builder
.
Build
(
&
my_mindrecord_op
);
ASSERT_TRUE
(
rc
.
IsOk
());
std
::
cout
<<
(
*
my_mindrecord_op
);
MS_LOG
(
DEBUG
)
<<
(
*
my_mindrecord_op
);
rc
=
my_tree
->
AssociateNode
(
my_mindrecord_op
);
EXPECT_TRUE
(
rc
.
IsOk
());
...
...
tests/ut/cpp/dataset/mnist_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -91,7 +91,8 @@ TEST_F(MindDataTestMnistSampler, TestSequentialMnistWithRepeat) {
while
(
tensor_map
.
size
()
!=
0
)
{
tensor_map
[
"label"
]
->
GetItemAt
<
uint32_t
>
(
&
label
,
{});
EXPECT_TRUE
(
res
[
i
%
10
]
==
label
);
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
label
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
20
);
...
...
@@ -120,7 +121,8 @@ TEST_F(MindDataTestMnistSampler, TestSequentialImageFolderWithRepeatBatch) {
std
::
shared_ptr
<
Tensor
>
label
;
Create1DTensor
(
&
label
,
5
,
reinterpret_cast
<
unsigned
char
*>
(
res
[
i
%
4
]));
EXPECT_TRUE
((
*
label
)
==
(
*
tensor_map
[
"label"
]));
std
::
cout
<<
"row: "
<<
i
++
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
*
tensor_map
[
"label"
]
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
"row: "
<<
i
<<
"
\t
"
<<
tensor_map
[
"image"
]
->
shape
()
<<
"label:"
<<
*
tensor_map
[
"label"
]
<<
"
\n
"
;
i
++
;
di
.
GetNextAsMap
(
&
tensor_map
);
}
EXPECT_TRUE
(
i
==
4
);
...
...
tests/ut/cpp/dataset/normalize_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -51,7 +51,7 @@ TEST_F(MindDataTestNormalizeOP, TestOp) {
cv
::
Mat
cv_output_image
;
cv_output_image
=
p
->
mat
();
std
::
cout
<<
"Storing output file to : "
<<
output_filename
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
"Storing output file to : "
<<
output_filename
<<
std
::
endl
;
cv
::
FileStorage
file
(
output_filename
,
cv
::
FileStorage
::
WRITE
);
file
<<
"imageData"
<<
cv_output_image
;
}
tests/ut/cpp/dataset/one_hot_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -47,8 +47,8 @@ TEST_F(MindDataTestOneHotOp, TestOp) {
EXPECT_TRUE
(
s
.
IsOk
());
ASSERT_TRUE
(
output
->
shape
()
==
expected
->
shape
());
ASSERT_TRUE
(
output
->
type
()
==
expected
->
type
());
std
::
cout
<<
*
output
<<
std
::
endl
;
std
::
cout
<<
*
expected
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
output
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
expected
<<
std
::
endl
;
ASSERT_TRUE
(
*
output
==
*
expected
);
MS_LOG
(
INFO
)
<<
"MindDataTestOneHotOp end."
;
...
...
tests/ut/cpp/dataset/path_test.cc
浏览文件 @
080bcda0
...
...
@@ -38,7 +38,7 @@ TEST_F(MindDataTestPath, Test1) {
int
i
=
0
;
while
(
dir_it
->
hasNext
())
{
Path
v
=
dir_it
->
next
();
std
::
cout
<<
v
.
toString
()
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
v
.
toString
()
<<
"
\n
"
;
i
++
;
if
(
i
==
10
)
{
break
;
...
...
@@ -46,7 +46,7 @@ TEST_F(MindDataTestPath, Test1) {
}
// Test extension.
Path
g
(
"file.jpeg"
);
std
::
cout
<<
g
.
Extension
()
<<
"
\n
"
;
MS_LOG
(
DEBUG
)
<<
g
.
Extension
()
<<
"
\n
"
;
ASSERT_EQ
(
g
.
Extension
(),
".jpeg"
);
}
...
...
tests/ut/cpp/dataset/queue_test.cc
浏览文件 @
080bcda0
...
...
@@ -44,7 +44,7 @@ class RefCount {
explicit
RefCount
(
int
x
)
:
v_
(
std
::
make_shared
<
int
>
(
x
))
{}
explicit
RefCount
(
const
RefCount
&
o
)
:
v_
(
o
.
v_
)
{}
~
RefCount
()
{
std
::
cout
<<
"Destructor of RefCount called"
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
"Destructor of RefCount called"
<<
std
::
endl
;
gRefCountDestructorCalled
++
;
}
RefCount
&
operator
=
(
const
RefCount
&
o
)
{
...
...
tests/ut/cpp/dataset/random_crop_decode_resizeOp_test.cc
浏览文件 @
080bcda0
...
...
@@ -78,7 +78,7 @@ TEST_F(MindDataTestRandomCropDecodeResizeOp, TestOp2) {
}
else
{
mse
=
mse_sum
;
}
std
::
cout
<<
"mse: "
<<
mse
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
"mse: "
<<
mse
<<
std
::
endl
;
}
MS_LOG
(
INFO
)
<<
"MindDataTestRandomCropDecodeResizeOp end!"
;
}
...
...
@@ -150,7 +150,7 @@ TEST_F(MindDataTestRandomCropDecodeResizeOp, TestOp1) {
}
mse
=
(
count
==
0
)
?
mse_sum
:
static_cast
<
float
>
(
mse_sum
)
/
count
;
std
::
cout
<<
"mse: "
<<
mse
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
"mse: "
<<
mse
<<
std
::
endl
;
}
MS_LOG
(
INFO
)
<<
"MindDataTestRandomCropDecodeResizeOp end!"
;
}
tests/ut/cpp/dataset/stand_alone_samplers_test.cc
浏览文件 @
080bcda0
...
...
@@ -78,7 +78,7 @@ TEST_F(MindDataTestStandAloneSampler, TestDistributedSampler) {
sampler
->
Init
(
&
mock
);
sampler
->
GetNextBuffer
(
&
db
);
db
->
GetTensor
(
&
tensor
,
0
,
0
);
std
::
cout
<<
(
*
tensor
);
MS_LOG
(
DEBUG
)
<<
(
*
tensor
);
if
(
i
<
3
)
{
// This is added due to std::shuffle()
EXPECT_TRUE
((
*
tensor
)
==
(
*
row
[
i
]));
}
...
...
tests/ut/cpp/dataset/status_test.cc
浏览文件 @
080bcda0
...
...
@@ -43,19 +43,19 @@ TEST_F(MindDataTestStatus, Test1) {
Status
rc
;
ASSERT_TRUE
(
rc
.
IsOk
());
Status
err1
(
StatusCode
::
kOutOfMemory
,
__LINE__
,
__FILE__
);
std
::
cout
<<
err1
;
MS_LOG
(
DEBUG
)
<<
err1
;
ASSERT_TRUE
(
err1
.
IsOutofMemory
());
ASSERT_TRUE
(
err1
.
IsError
());
Status
err2
(
StatusCode
::
kUnexpectedError
,
__LINE__
,
__FILE__
,
"Oops"
);
std
::
cout
<<
err2
;
MS_LOG
(
DEBUG
)
<<
err2
;
}
TEST_F
(
MindDataTestStatus
,
Test2
)
{
Status
rc
=
f1
();
std
::
cout
<<
rc
;
MS_LOG
(
DEBUG
)
<<
rc
;
}
TEST_F
(
MindDataTestStatus
,
Test3
)
{
Status
rc
=
f3
();
std
::
cout
<<
rc
;
MS_LOG
(
DEBUG
)
<<
rc
;
}
tests/ut/cpp/dataset/task_manager_test.cc
浏览文件 @
080bcda0
...
...
@@ -36,7 +36,7 @@ Status f(TaskGroup &vg){
RETURN_IF_NOT_OK
(
vg
.
CreateAsyncTask
(
"Infinity"
,
[
&
]()
->
Status
{
TaskManager
::
FindMe
()
->
Post
();
int
a
=
v
.
fetch_add
(
1
);
std
::
cout
<<
a
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
a
<<
std
::
endl
;
return
f
(
vg
);
}));
}
...
...
tests/ut/cpp/dataset/tensor_test.cc
浏览文件 @
080bcda0
...
...
@@ -311,7 +311,7 @@ TEST_F(MindDataTestTensorDE, CVTensorAs) {
m
=
2
*
m
;
ASSERT_EQ
(
ctv
->
StartAddr
(),
addr
);
ASSERT_TRUE
(
*
t2
==
*
ctv
);
std
::
cout
<<
*
t2
<<
std
::
endl
<<
*
ctv
;
MS_LOG
(
DEBUG
)
<<
*
t2
<<
std
::
endl
<<
*
ctv
;
}
TEST_F
(
MindDataTestTensorDE
,
CVTensorMatSlice
)
{
...
...
tests/ut/cpp/dataset/type_cast_op_test.cc
浏览文件 @
080bcda0
...
...
@@ -54,7 +54,7 @@ void testCast(std::vector<FROM> values, const DataType &from, const DataType &to
EXPECT_TRUE
(
op
->
Compute
(
t
,
&
output
));
ASSERT_TRUE
(
t
->
shape
()
==
output
->
shape
());
ASSERT_TRUE
(
DataType
(
to
)
==
output
->
type
());
std
::
cout
<<
*
output
<<
std
::
endl
;
MS_LOG
(
DEBUG
)
<<
*
output
<<
std
::
endl
;
auto
out
=
output
->
begin
<
TO
>
();
auto
v
=
values
.
begin
();
for
(;
out
!=
output
->
end
<
TO
>
();
out
++
,
v
++
)
{
...
...
tests/ut/cpp/mindrecord/ut_shard_operator_test.cc
浏览文件 @
080bcda0
...
...
@@ -58,7 +58,8 @@ TEST_F(TestShardOperator, TestShardSampleBasic) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
i
++
;
}
dataset
.
Finish
();
ASSERT_TRUE
(
i
<=
kSampleCount
);
...
...
@@ -83,7 +84,8 @@ TEST_F(TestShardOperator, TestShardSampleWrongNumber) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
i
++
;
}
dataset
.
Finish
();
ASSERT_TRUE
(
i
<=
5
);
...
...
@@ -108,7 +110,8 @@ TEST_F(TestShardOperator, TestShardSampleRatio) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
i
++
;
}
dataset
.
Finish
();
ASSERT_TRUE
(
i
<=
10
);
...
...
@@ -137,7 +140,8 @@ TEST_F(TestShardOperator, TestShardSamplePartition) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]);
i
++
;
}
dataset
.
Finish
();
ASSERT_TRUE
(
i
<=
10
);
...
...
@@ -166,8 +170,9 @@ TEST_F(TestShardOperator, TestShardCategory) {
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
ASSERT_TRUE
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
]
==
categories
[
category_no
].
second
);
...
...
@@ -194,8 +199,9 @@ TEST_F(TestShardOperator, TestShardShuffle) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
}
dataset
.
Finish
();
}
...
...
@@ -218,8 +224,9 @@ TEST_F(TestShardOperator, TestShardSampleShuffle) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
}
dataset
.
Finish
();
ASSERT_LE
(
i
,
35
);
...
...
@@ -244,8 +251,9 @@ TEST_F(TestShardOperator, TestShardShuffleSample) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
}
dataset
.
Finish
();
ASSERT_TRUE
(
i
<=
kSampleSize
);
...
...
@@ -270,8 +278,9 @@ TEST_F(TestShardOperator, TestShardSampleShuffleSample) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
}
dataset
.
Finish
();
ASSERT_LE
(
i
,
35
);
...
...
@@ -298,8 +307,9 @@ TEST_F(TestShardOperator, TestShardShuffleCompare) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
auto
y
=
compare_dataset
.
GetNext
();
if
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
]
!=
(
std
::
get
<
1
>
(
y
[
0
]))[
"file_name"
])
different
=
true
;
...
...
@@ -332,8 +342,9 @@ TEST_F(TestShardOperator, TestShardCategoryShuffle1) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
ASSERT_TRUE
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
]
==
categories
[
category_no
].
second
);
category_no
++
;
...
...
@@ -365,8 +376,9 @@ TEST_F(TestShardOperator, TestShardCategoryShuffle2) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
ASSERT_TRUE
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
]
==
categories
[
category_no
].
second
);
category_no
++
;
category_no
%=
static_cast
<
int
>
(
categories
.
size
());
...
...
@@ -398,8 +410,9 @@ TEST_F(TestShardOperator, TestShardCategorySample) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
ASSERT_TRUE
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
]
==
categories
[
category_no
].
second
);
category_no
++
;
...
...
@@ -435,8 +448,9 @@ TEST_F(TestShardOperator, TestShardCategorySampleShuffle) {
while
(
true
)
{
auto
x
=
dataset
.
GetNext
();
if
(
x
.
empty
())
break
;
MS_LOG
(
INFO
)
<<
"index: "
<<
i
++
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
MS_LOG
(
INFO
)
<<
"index: "
<<
i
<<
", filename: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"file_name"
])
<<
", label: "
<<
common
::
SafeCStr
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
].
dump
());
i
++
;
ASSERT_TRUE
((
std
::
get
<
1
>
(
x
[
0
]))[
"label"
]
==
categories
[
category_no
].
second
);
category_no
++
;
...
...
tests/ut/cpp/runtest.sh
浏览文件 @
080bcda0
...
...
@@ -28,6 +28,7 @@ cd ${BUILD_PATH}/mindspore/tests/ut/cpp
export
LD_LIBRARY_PATH
=
${
BUILD_PATH
}
/mindspore/googletest/googlemock/gtest:
${
PROJECT_PATH
}
/mindspore:
${
PROJECT_PATH
}
/mindspore/lib:
$LD_LIBRARY_PATH
export
PYTHONPATH
=
${
PROJECT_PATH
}
/tests/ut/cpp/python_input:
$PYTHONPATH
:
${
PROJECT_PATH
}
export
GLOG_v
=
2
## prepare data for dataset & mindrecord
cp
-fr
$PROJECT_PATH
/tests/ut/data
${
PROJECT_PATH
}
/build/mindspore/tests/ut/cpp/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录