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

Function ConvertVariableToConstant

tensorflow/cc/tools/freeze_saved_model.cc:155–163  ·  view source on GitHub ↗

Converts a Variable NodeDef into a Constant NodeDef.

Source from the content-addressed store, hash-verified

153
154// Converts a Variable NodeDef into a Constant NodeDef.
155void ConvertVariableToConstant(const NodeDef& variable_node,
156 const Tensor& variable_value,
157 NodeDef* const_node) {
158 const_node->set_name(variable_node.name());
159 const_node->set_op("Const");
160 (*const_node->mutable_attr())["dtype"] = variable_node.attr().at("dtype");
161 variable_value.AsProtoTensorContent(
162 (*const_node->mutable_attr())["value"].mutable_tensor());
163}
164
165// Converts a ReadVariableOp NodeDef to an Identity NodeDef.
166void ConvertReadVariableOpToIdentity(const NodeDef& node,

Callers 1

FreezeGraphDefFunction · 0.85

Calls 6

set_opMethod · 0.80
attrMethod · 0.80
AsProtoTensorContentMethod · 0.80
nameMethod · 0.65
set_nameMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected