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

Function ConstHelper

tensorflow/cc/ops/const_op.cc:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace {
23template <typename T>
24Output ConstHelper(const Scope& scope, const T& value, DataType dtype) {
25 if (!scope.ok()) return Output();
26
27 Node* ret;
28 Graph* graph = scope.graph();
29 const string unique_name = scope.GetUniqueNameForOp("Const");
30 auto builder = NodeBuilder(unique_name, "Const")
31 .Attr("value", value)
32 .Attr("dtype", dtype);
33 scope.UpdateBuilder(&builder);
34 scope.UpdateStatus(builder.Finalize(graph, &ret));
35 if (!scope.ok()) return Output();
36
37 scope.UpdateStatus(scope.DoShapeInference(ret));
38 if (!scope.ok()) return Output();
39
40 return Output(ret);
41}
42} // namespace
43
44Output Const(const Scope& scope, const Input::Initializer& val) {

Callers 2

ConstFunction · 0.70
ConstFromProtoFunction · 0.70

Calls 10

GetUniqueNameForOpMethod · 0.80
UpdateBuilderMethod · 0.80
DoShapeInferenceMethod · 0.80
OutputClass · 0.50
NodeBuilderClass · 0.50
okMethod · 0.45
graphMethod · 0.45
AttrMethod · 0.45
UpdateStatusMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected