Project import generated by Copybara.

GitOrigin-RevId: 6f964e58d874e47fb6207aa97d060a4cd6428527
This commit is contained in:
MediaPipe Team
2020-03-02 10:35:07 -08:00
committed by jqtang
parent de4fbc10e6
commit 252a5713c7
134 changed files with 16665 additions and 874 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ cc_library(
deps = [
"//mediapipe/framework:packet",
"//mediapipe/framework/port:statusor",
"@org_tensorflow//tensorflow/core:protos_all",
"@org_tensorflow//tensorflow/core:protos_all_cc",
],
)
+10 -5
View File
@@ -52,8 +52,10 @@ TEST(StatusTest, CombinedStatus) {
errors.emplace_back(::mediapipe::StatusCode::kInvalidArgument,
"error_with_that_string");
status = tool::CombinedStatus(prefix_error_message, errors);
EXPECT_THAT(status.ToString(), testing::HasSubstr(errors[0].error_message()));
EXPECT_THAT(status.ToString(), testing::HasSubstr(errors[1].error_message()));
EXPECT_THAT(status.ToString(),
testing::HasSubstr(std::string(errors[0].message())));
EXPECT_THAT(status.ToString(),
testing::HasSubstr(std::string(errors[1].message())));
EXPECT_THAT(status.ToString(), testing::HasSubstr(prefix_error_message));
EXPECT_EQ(::mediapipe::StatusCode::kInvalidArgument, status.code());
@@ -63,8 +65,10 @@ TEST(StatusTest, CombinedStatus) {
errors.emplace_back(::mediapipe::StatusCode::kInvalidArgument,
"error_with_that_string");
status = tool::CombinedStatus(prefix_error_message, errors);
EXPECT_THAT(status.ToString(), testing::HasSubstr(errors[0].error_message()));
EXPECT_THAT(status.ToString(), testing::HasSubstr(errors[1].error_message()));
EXPECT_THAT(status.ToString(),
testing::HasSubstr(std::string(errors[0].message())));
EXPECT_THAT(status.ToString(),
testing::HasSubstr(std::string(errors[1].message())));
EXPECT_THAT(status.ToString(), testing::HasSubstr(prefix_error_message));
EXPECT_EQ(::mediapipe::StatusCode::kUnknown, status.code());
errors.clear();
@@ -72,7 +76,8 @@ TEST(StatusTest, CombinedStatus) {
errors.emplace_back(::mediapipe::StatusCode::kInvalidArgument,
"error_with_that_string");
status = tool::CombinedStatus(prefix_error_message, errors);
EXPECT_THAT(status.ToString(), testing::HasSubstr(errors[1].error_message()));
EXPECT_THAT(status.ToString(),
testing::HasSubstr(std::string(errors[1].message())));
EXPECT_THAT(status.ToString(), testing::HasSubstr(prefix_error_message));
EXPECT_EQ(::mediapipe::StatusCode::kInvalidArgument, status.code());
@@ -76,10 +76,11 @@ namespace tool {
::mediapipe::Status RemoveIgnoredStreams(
proto_ns::RepeatedPtrField<ProtoString>* streams,
const std::set<std::string>& missing_streams) {
ASSIGN_OR_RETURN(auto src_map, tool::TagMap::Create(*streams));
std::vector<std::string> src_names = src_map->Names();
for (int i = streams->size() - 1; i >= 0; --i) {
if (missing_streams.count(src_names[i]) > 0) {
std::string tag, name;
int index;
MP_RETURN_IF_ERROR(ParseTagIndexName(streams->Get(i), &tag, &index, &name));
if (missing_streams.count(name) > 0) {
streams->DeleteSubrange(i, 1);
}
}