forked from mindspore-Ecosystem/mindspore
Replace std::cout with MS_LOG in dataset unit test
Signed-off-by: Jonathan Yan <jonathan.yan1@huawei.com>
This commit is contained in:
parent
062b744b19
commit
080bcda021
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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++ << "\tlabel:" << label << "\n";
|
||||
MS_LOG(DEBUG) << "row:" << i << "\tlabel:" << 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++ << "\tlabel:" << label << "\n";
|
||||
MS_LOG(DEBUG) << "row:" << i << "\tlabel:" << 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++ << "\tlabel:" << label << "\n";
|
||||
MS_LOG(DEBUG) << "row:" << i << "\tlabel:" << label << "\n";
|
||||
i++;
|
||||
di.GetNextAsMap(&tensor_map);
|
||||
}
|
||||
EXPECT_TRUE(i == 11);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 << "\tlabel:" << label << "\n";
|
||||
MS_LOG(DEBUG) << "row:" << i << "\tlabel:" << 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 << "\tlabel:" << label << "\n";
|
||||
MS_LOG(DEBUG) << "row:" << i << "\tlabel:" << 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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.";
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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!";
|
||||
}
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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/
|
||||
|
|
Loading…
Reference in New Issue