Project import generated by Copybara.

GitOrigin-RevId: b137378673f7d66d41bcd46e4fc3a0d9ef254894
This commit is contained in:
MediaPipe Team
2019-10-25 14:29:15 -07:00
committed by jqtang
parent a2a63e3876
commit 259b48e082
94 changed files with 8564 additions and 398 deletions
+5
View File
@@ -127,6 +127,11 @@ class TagMap {
std::vector<std::string> names_;
};
// Equal TagData structs define equal id ranges.
inline bool operator==(const TagMap::TagData& d1, const TagMap::TagData& d2) {
return d1.id == d2.id && d1.count == d2.count;
}
} // namespace tool
} // namespace mediapipe
@@ -567,6 +567,10 @@ class TemplateExpanderImpl {
result = AsDict(args);
} else if (expr.op() == "list") {
result = AsList(args);
} else if (expr.op() == "size") {
return AsArgument(static_cast<double>(
args[0].has_dict() ? args[0].mutable_dict()->arg_size()
: args[0].mutable_element()->size()));
}
return result;
}
+2 -2
View File
@@ -1318,8 +1318,8 @@ bool IsInfixOperator(const std::string& token) {
// A function-style operator, including a for or if expression.
bool IsFunctionOperator(const std::string& token) {
static auto kTokens = new std::set<std::string>{
"min", "max", "for", "if", "!",
"concat", "lowercase", "uppercase", "dict", "list",
"min", "max", "for", "if", "!", "concat",
"lowercase", "uppercase", "size", "dict", "list",
};
return kTokens->count(token) > 0;
}