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

Function CreateFakeConstOp

serving/processor/framework/graph_optimizer.cc:1993–2010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1991} while(0)
1992
1993Status CreateFakeConstOp(const std::string& name,
1994 DataType type, Graph* graph,
1995 Node** fake_const,
1996 Tensor* content = nullptr) {
1997 NodeDef def;
1998 def.set_name(name);
1999 def.set_op("Const");
2000 auto* attr = def.mutable_attr();
2001 (*attr)["dtype"].set_type(type);
2002 if (content != nullptr) {
2003 content->AsProtoTensorContent((*attr)["value"].mutable_tensor());
2004 } else {
2005 SET_DEFAULT_CONST_ATTR(attr, type);
2006 }
2007 Status status;
2008 *fake_const = graph->AddNode(def, &status);
2009 return status;
2010}
2011
2012Status CreateStringJoinOp(const std::string& name,
2013 std::vector<SrcInfo> input_info,

Callers 1

CreateIncrRestoreOpMethod · 0.85

Calls 4

set_opMethod · 0.80
AsProtoTensorContentMethod · 0.80
set_nameMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected