MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AllowedStringValue

Function AllowedStringValue

tensorflow/core/framework/op_def_util.cc:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65Status AllowedStringValue(const string& str, const OpDef::AttrDef& attr) {
66 const AttrValue& allowed_values(attr.allowed_values());
67 for (const auto& allowed : allowed_values.list().s()) {
68 if (str == allowed) {
69 return Status::OK();
70 }
71 }
72 string allowed_str;
73 for (const string& allowed : allowed_values.list().s()) {
74 if (!allowed_str.empty()) {
75 strings::StrAppend(&allowed_str, ", ");
76 }
77 strings::StrAppend(&allowed_str, "\"", allowed, "\"");
78 }
79 return errors::InvalidArgument(
80 "Value for attr '", attr.name(), "' of \"", str,
81 "\" is not in the list of allowed values: ", allowed_str);
82}
83
84} // namespace
85

Callers 1

ValidateAttrValueFunction · 0.85

Calls 5

InvalidArgumentFunction · 0.85
listMethod · 0.80
nameMethod · 0.65
StrAppendFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected