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

Function AddPrefixAndSuffixToNode

tensorflow/core/framework/node_def_util.cc:910–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908#undef ADD_ATTR
909
910Status AddPrefixAndSuffixToNode(StringPiece prefix, StringPiece suffix,
911 NodeDef* node_def, bool uniquify_frame_name) {
912 node_def->set_name(strings::StrCat(prefix, node_def->name(), suffix));
913
914 // Update frame name to avoid multiple LoopCond nodes in one frame.
915 if (uniquify_frame_name &&
916 (node_def->op() == "Enter" || node_def->op() == "RefEnter")) {
917 string frame_name;
918 TF_RETURN_IF_ERROR(GetNodeAttr(*node_def, "frame_name", &frame_name));
919 AttrValue& attr = (*node_def->mutable_attr())["frame_name"];
920 frame_name = strings::StrCat(prefix, frame_name, suffix);
921 attr.set_s(frame_name);
922 }
923
924 // Update colocation constraints.
925 constexpr char kClassAttr[] = "_class";
926 auto class_attr = node_def->mutable_attr()->find(kClassAttr);
927 if (class_attr != node_def->mutable_attr()->end()) {
928 AttrValue new_value;
929 new_value.mutable_list()->add_s(
930 strings::StrCat(prefix, class_attr->second.s()));
931 node_def->mutable_attr()->erase(kClassAttr);
932 node_def->mutable_attr()->insert({kClassAttr, new_value});
933 }
934
935 return Status::OK();
936}
937
938} // namespace tensorflow

Callers 2

TESTFunction · 0.85
InlineFunctionBodyFunction · 0.85

Calls 9

nameMethod · 0.65
StrCatFunction · 0.50
GetNodeAttrFunction · 0.50
set_nameMethod · 0.45
opMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by 1

TESTFunction · 0.68