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

Function Create1DStringConstOp

serving/processor/framework/graph_optimizer.cc:786–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

784}
785
786Status Create1DStringConstOp(const std::string& name,
787 tensorflow::DataType type,
788 const std::string& value,
789 Graph* graph, Node** new_node) {
790 NodeDef const_def;
791 const_def.set_name(name);
792 const_def.set_op("Const");
793 auto* attr = const_def.mutable_attr();
794 (*attr)["dtype"].set_type(type);
795 Tensor const_tensor(type, TensorShape({1}));
796 const_tensor.vec<std::string>()(0) = value;
797 const_tensor.AsProtoTensorContent((*attr)["value"].mutable_tensor());
798
799 Status s_add_node;
800 *new_node = graph->AddNode(const_def, &s_add_node);
801 return s_add_node;
802}
803
804Status CreateRestoreOp(const std::string& name,
805 std::vector<SrcInfo>& input_info,

Callers 1

ConvertToHashImportOpMethod · 0.85

Calls 5

set_opMethod · 0.80
AsProtoTensorContentMethod · 0.80
TensorShapeClass · 0.50
set_nameMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected