@ -35,7 +35,7 @@ TEST_F(MindDataTestPipeline, TestComposeSuccess) {
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , false , RandomSampler ( false , 3 ) ) ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , false , RandomSampler ( false , 3 ) ) ;
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
/* FIXME - Disable until proper external API for Compose is provided
// Create objects for the tensor ops
// Create objects for the tensor ops
std : : shared_ptr < TensorOperation > compose = transforms : : Compose ( { vision : : Decode ( ) , vision : : Resize ( { 777 , 777 } ) } ) ;
std : : shared_ptr < TensorOperation > compose = transforms : : Compose ( { vision : : Decode ( ) , vision : : Resize ( { 777 , 777 } ) } ) ;
EXPECT_NE ( compose , nullptr ) ;
EXPECT_NE ( compose , nullptr ) ;
@ -69,11 +69,12 @@ TEST_F(MindDataTestPipeline, TestComposeSuccess) {
// Manually terminate the pipeline
// Manually terminate the pipeline
iter - > Stop ( ) ;
iter - > Stop ( ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestComposeFail ) {
TEST_F ( MindDataTestPipeline , TestComposeFail ) {
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestComposeFail with invalid transform. " ;
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestComposeFail with invalid transform. " ;
/* FIXME - Disable until proper external API for Compose is provided
// Resize: Non-positive size value: -1 at element: 0
// Resize: Non-positive size value: -1 at element: 0
// Compose: transform ops must not be null
// Compose: transform ops must not be null
std : : shared_ptr < TensorOperation > compose1 = transforms : : Compose ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
std : : shared_ptr < TensorOperation > compose1 = transforms : : Compose ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
@ -86,6 +87,7 @@ TEST_F(MindDataTestPipeline, TestComposeFail) {
// Compose: transform list must not be empty
// Compose: transform list must not be empty
std : : shared_ptr < TensorOperation > compose3 = transforms : : Compose ( { } ) ;
std : : shared_ptr < TensorOperation > compose3 = transforms : : Compose ( { } ) ;
EXPECT_EQ ( compose3 , nullptr ) ;
EXPECT_EQ ( compose3 , nullptr ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestDuplicateSuccess ) {
TEST_F ( MindDataTestPipeline , TestDuplicateSuccess ) {
@ -137,7 +139,7 @@ TEST_F(MindDataTestPipeline, TestOneHotSuccess1) {
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
// Create objects for the tensor ops
// Create objects for the tensor ops
std : : shared_ptr < Tensor Operation > hwc_to_chw = vision: : HWC2CHW ( ) ;
std : : shared_ptr < Tensor Transform > hwc_to_chw = std: : make_shared < vision: : HWC2CHW > ( ) ;
EXPECT_NE ( hwc_to_chw , nullptr ) ;
EXPECT_NE ( hwc_to_chw , nullptr ) ;
// Create a Map operation on ds
// Create a Map operation on ds
@ -157,8 +159,8 @@ TEST_F(MindDataTestPipeline, TestOneHotSuccess1) {
ds = ds - > Map ( { one_hot_op } , { " label " } ) ;
ds = ds - > Map ( { one_hot_op } , { " label " } ) ;
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
std : : shared_ptr < Tensor Operation > cutmix_batch_op =
std : : shared_ptr < Tensor Transform > cutmix_batch_op =
vision: : CutMixBatch ( mindspore : : dataset : : ImageBatchFormat : : kNCHW , 1.0 , 1.0 ) ;
std: : make_shared < vision: : CutMixBatch > ( mindspore : : dataset : : ImageBatchFormat : : kNCHW , 1.0 , 1.0 ) ;
EXPECT_NE ( cutmix_batch_op , nullptr ) ;
EXPECT_NE ( cutmix_batch_op , nullptr ) ;
// Create a Map operation on ds
// Create a Map operation on ds
@ -215,7 +217,7 @@ TEST_F(MindDataTestPipeline, TestOneHotSuccess2) {
ds = ds - > Map ( { one_hot_op } , { " label " } ) ;
ds = ds - > Map ( { one_hot_op } , { " label " } ) ;
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
std : : shared_ptr < Tensor Operation > mixup_batch_op = vision: : MixUpBatch ( 2.0 ) ;
std : : shared_ptr < Tensor Transform > mixup_batch_op = std: : make_shared < vision: : MixUpBatch > ( 2.0 ) ;
EXPECT_NE ( mixup_batch_op , nullptr ) ;
EXPECT_NE ( mixup_batch_op , nullptr ) ;
// Create a Map operation on ds
// Create a Map operation on ds
@ -294,7 +296,7 @@ TEST_F(MindDataTestPipeline, TestRandomApplySuccess) {
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , true , RandomSampler ( false , 5 ) ) ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , true , RandomSampler ( false , 5 ) ) ;
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
/* FIXME - Disable until proper external API for RandomApply is provided
// Create objects for the tensor ops
// Create objects for the tensor ops
std : : shared_ptr < TensorOperation > random_apply = transforms : : RandomApply ( { vision : : Resize ( { 777 , 777 } ) } , 0.8 ) ;
std : : shared_ptr < TensorOperation > random_apply = transforms : : RandomApply ( { vision : : Resize ( { 777 , 777 } ) } , 0.8 ) ;
EXPECT_NE ( random_apply , nullptr ) ;
EXPECT_NE ( random_apply , nullptr ) ;
@ -326,11 +328,12 @@ TEST_F(MindDataTestPipeline, TestRandomApplySuccess) {
// Manually terminate the pipeline
// Manually terminate the pipeline
iter - > Stop ( ) ;
iter - > Stop ( ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestRandomApplyFail ) {
TEST_F ( MindDataTestPipeline , TestRandomApplyFail ) {
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestRandomApplyFail with invalid transform. " ;
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestRandomApplyFail with invalid transform. " ;
/* FIXME - Disable until proper external API for RandomApply is provided
// Resize: Non-positive size value: -1 at element: 0
// Resize: Non-positive size value: -1 at element: 0
// RandomApply: transform ops must not be null
// RandomApply: transform ops must not be null
std : : shared_ptr < TensorOperation > random_apply1 = transforms : : RandomApply ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
std : : shared_ptr < TensorOperation > random_apply1 = transforms : : RandomApply ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
@ -347,6 +350,7 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail) {
// RandomApply: Probability has to be between 0 and 1
// RandomApply: Probability has to be between 0 and 1
std : : shared_ptr < TensorOperation > random_apply4 = transforms : : RandomApply ( { vision : : Resize ( { 100 } ) } , - 1 ) ;
std : : shared_ptr < TensorOperation > random_apply4 = transforms : : RandomApply ( { vision : : Resize ( { 100 } ) } , - 1 ) ;
EXPECT_EQ ( random_apply4 , nullptr ) ;
EXPECT_EQ ( random_apply4 , nullptr ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestRandomChoiceSuccess ) {
TEST_F ( MindDataTestPipeline , TestRandomChoiceSuccess ) {
@ -356,7 +360,7 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceSuccess) {
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : string folder_path = datasets_root_path_ + " /testPK/data/ " ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , true , RandomSampler ( false , 3 ) ) ;
std : : shared_ptr < Dataset > ds = ImageFolder ( folder_path , true , RandomSampler ( false , 3 ) ) ;
EXPECT_NE ( ds , nullptr ) ;
EXPECT_NE ( ds , nullptr ) ;
/* FIXME - Disable until proper external API for RandomChoice is provided
// Create objects for the tensor ops
// Create objects for the tensor ops
std : : shared_ptr < TensorOperation > random_choice =
std : : shared_ptr < TensorOperation > random_choice =
transforms : : RandomChoice ( { vision : : Resize ( { 777 , 777 } ) , vision : : Resize ( { 888 , 888 } ) } ) ;
transforms : : RandomChoice ( { vision : : Resize ( { 777 , 777 } ) , vision : : Resize ( { 888 , 888 } ) } ) ;
@ -389,11 +393,12 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceSuccess) {
// Manually terminate the pipeline
// Manually terminate the pipeline
iter - > Stop ( ) ;
iter - > Stop ( ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestRandomChoiceFail ) {
TEST_F ( MindDataTestPipeline , TestRandomChoiceFail ) {
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestRandomChoiceFail with invalid transform. " ;
MS_LOG ( INFO ) < < " Doing MindDataTestPipeline-TestRandomChoiceFail with invalid transform. " ;
/* FIXME - Disable until proper external API for RandomChoice is provided
// Resize: Non-positive size value: -1 at element: 0
// Resize: Non-positive size value: -1 at element: 0
// RandomChoice: transform ops must not be null
// RandomChoice: transform ops must not be null
std : : shared_ptr < TensorOperation > random_choice1 = transforms : : RandomChoice ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
std : : shared_ptr < TensorOperation > random_choice1 = transforms : : RandomChoice ( { vision : : Decode ( ) , vision : : Resize ( { - 1 } ) } ) ;
@ -406,6 +411,7 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceFail) {
// RandomChoice: transform list must not be empty
// RandomChoice: transform list must not be empty
std : : shared_ptr < TensorOperation > random_choice3 = transforms : : RandomChoice ( { } ) ;
std : : shared_ptr < TensorOperation > random_choice3 = transforms : : RandomChoice ( { } ) ;
EXPECT_EQ ( random_choice3 , nullptr ) ;
EXPECT_EQ ( random_choice3 , nullptr ) ;
*/
}
}
TEST_F ( MindDataTestPipeline , TestTypeCastSuccess ) {
TEST_F ( MindDataTestPipeline , TestTypeCastSuccess ) {