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

Function ModifySharedNameAttr

serving/processor/framework/graph_optimizer.cc:1095–1117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095Status ModifySharedNameAttr(Node* new_var_op, int curr_partition_id) {
1096 std::string shared_name;
1097 TF_RETURN_IF_ERROR(GetNodeAttr(new_var_op->attrs(), "shared_name", &shared_name));
1098 if (shared_name == "") {
1099 LOG(FATAL) << "KvVarHandleOp can not contain the shared_name attr: "
1100 << new_var_op->DebugString();
1101 }
1102
1103 auto offset = shared_name.find("/part_");
1104 if (offset == std::string::npos) {
1105 shared_name = shared_name + "/part_" + std::to_string(curr_partition_id);
1106 } else {
1107 // Inference graph is not contain slot variable node, so we do not need to consider
1108 // xx/yy/zz/part_0/aa pattern here
1109 shared_name = shared_name.substr(0, offset) +
1110 "/part_" + std::to_string(curr_partition_id);
1111 }
1112
1113 new_var_op->ClearAttr("shared_name");
1114 new_var_op->AddAttr("shared_name", shared_name);
1115
1116 return Status::OK();
1117}
1118
1119Node* CheckInputDefaultValNode(Node* node, int slot, int* src_slot) {
1120 for (const Edge* edge : node->in_edges()) {

Callers 2

Calls 7

to_stringFunction · 0.85
ClearAttrMethod · 0.80
AddAttrMethod · 0.80
GetNodeAttrFunction · 0.70
attrsMethod · 0.45
DebugStringMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected