Project import generated by Copybara.
GitOrigin-RevId: b137378673f7d66d41bcd46e4fc3a0d9ef254894
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user