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

Method AddVariableInitSubGraph

serving/processor/framework/graph_optimizer.cc:1702–1720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700}
1701
1702Status SavedModelOptimizer::AddVariableInitSubGraph() {
1703 // Add a init_op to initialize storage like redis.
1704 NodeDef init_op_def;
1705 init_op_def.set_name(GetInitNodeName());
1706 init_op_def.set_op("KvInit");
1707
1708 std::vector<std::string> feature_names;
1709 for (Node* node : graph_.nodes()) {
1710 // Add resource name as feature_names attr
1711 if (node->op_def().name() == "KvResourceImportV2") {
1712 feature_names.push_back(node->name());
1713 }
1714 }
1715 AddNodeAttr("feature_names", feature_names, &init_op_def);
1716
1717 Status status;
1718 Node* init_op_node = graph_.AddNode(init_op_def, &status);
1719 return status;
1720}
1721
1722namespace {
1723void GetResourceNodeFromRestoreOpInputs(

Callers

nothing calls this directly

Calls 8

set_opMethod · 0.80
nameMethod · 0.65
AddNodeAttrFunction · 0.50
set_nameMethod · 0.45
nodesMethod · 0.45
op_defMethod · 0.45
push_backMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected