diff --git a/mediapipe/tasks/c/text/text_classifier/text_classifier_test.cc b/mediapipe/tasks/c/text/text_classifier/text_classifier_test.cc index 1dd3f69101..af3f30fec6 100644 --- a/mediapipe/tasks/c/text/text_classifier/text_classifier_test.cc +++ b/mediapipe/tasks/c/text/text_classifier/text_classifier_test.cc @@ -65,7 +65,7 @@ TEST(TextClassifierTest, SmokeTest) { EXPECT_EQ(result.classifications[0].categories_count, 2); EXPECT_EQ(std::string{result.classifications[0].categories[0].category_name}, "positive"); - EXPECT_NEAR(result.classifications[0].categories[0].score, 0.999371, + EXPECT_NEAR(result.classifications[0].categories[0].score, 0.999465, kPrecision); text_classifier_close_result(&result); diff --git a/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc b/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc index 47622edb74..f67b7ccc45 100644 --- a/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc +++ b/mediapipe/tasks/c/text/text_embedder/text_embedder_test.cc @@ -91,7 +91,7 @@ TEST(TextEmbedderTest, SucceedsWithCosineSimilarity) { double similarity; text_embedder_cosine_similarity(&result0.embeddings[0], &result1.embeddings[0], &similarity, nullptr); - double expected_similarity = 0.98077; + double expected_similarity = 0.97565; EXPECT_LE(abs(similarity - expected_similarity), kPrecision); text_embedder_close_result(&result0); diff --git a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc index dfb78c07f0..507acbbb6e 100644 --- a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc +++ b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc @@ -151,15 +151,11 @@ TEST_F(TextClassifierTest, TextClassifierWithBert) { /*head_name=*/"probability"}); #else negative_expected.classifications.emplace_back(Classifications{ - /*categories=*/{ - {/*index=*/0, /*score=*/0.956316, /*category_name=*/"negative"}, - {/*index=*/1, /*score=*/0.043683, /*category_name=*/"positive"}}, + /*categories=*/{{0, 0.963325, "negative"}, {1, 0.036674, "positive"}}, /*head_index=*/0, /*head_name=*/"probability"}); positive_expected.classifications.emplace_back(Classifications{ - /*categories=*/{ - {/*index=*/1, /*score=*/0.999945, /*category_name=*/"positive"}, - {/*index=*/0, /*score=*/0.000056, /*category_name=*/"negative"}}, + /*categories=*/{{1, 0.9999413, "positive"}, {0, 0.000058, "negative"}}, /*head_index=*/0, /*head_name=*/"probability"}); #endif // _WIN32 @@ -255,10 +251,8 @@ TEST_F(TextClassifierTest, BertLongPositive) { categories.push_back( {/*index=*/0, /*score=*/0.023313, /*category_name=*/"negative"}); #else - categories.push_back( - {/*index=*/1, /*score=*/0.985889, /*category_name=*/"positive"}); - categories.push_back( - {/*index=*/0, /*score=*/0.014112, /*category_name=*/"negative"}); + categories.push_back({1, 0.981590, "positive"}); + categories.push_back({0, 0.018409, "negative"}); #endif // _WIN32 expected.classifications.emplace_back( diff --git a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc index 76634a922d..e70eacc9a4 100644 --- a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc +++ b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc @@ -82,7 +82,7 @@ TEST_F(EmbedderTest, SucceedsWithMobileBert) { #elif defined(__FMA__) ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 21.3605f, kEpsilon); #else - ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 19.9016f, kEpsilon); + ASSERT_NEAR(result0.embeddings[0].float_embedding[0], 21.1785f, kEpsilon); #endif // _WIN32 MP_ASSERT_OK_AND_ASSIGN( @@ -92,7 +92,7 @@ TEST_F(EmbedderTest, SucceedsWithMobileBert) { #ifdef __FMA__ ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 21.254150f, kEpsilon); #else - ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 22.626251f, kEpsilon); + ASSERT_NEAR(result1.embeddings[0].float_embedding[0], 20.322639f, kEpsilon); #endif // Check cosine similarity.