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

Function MoreRestrictive

tensorflow/core/framework/op_def_util.cc:442–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442bool MoreRestrictive(const OpDef::AttrDef& old_attr,
443 const OpDef::AttrDef& new_attr) {
444 // Anything -> no restriction : not more restrictive.
445 if (!new_attr.has_allowed_values()) return false;
446 // No restriction -> restriction : more restrictive.
447 if (!old_attr.has_allowed_values()) return true;
448 // If anything that was previously allowed is no longer allowed:
449 // more restrictive.
450 if (!IsSubsetOf(old_attr.allowed_values().list().type(),
451 new_attr.allowed_values().list().type())) {
452 return true;
453 }
454 if (!IsSubsetOf(old_attr.allowed_values().list().s(),
455 new_attr.allowed_values().list().s())) {
456 return true;
457 }
458 return false;
459}
460
461string AllowedStr(const OpDef::AttrDef& attr) {
462 if (!attr.has_allowed_values()) return "no restriction";

Callers 1

OpDefCompatibleFunction · 0.85

Calls 3

IsSubsetOfFunction · 0.85
listMethod · 0.80
typeMethod · 0.65

Tested by

no test coverage detected