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

Function Call

tensorflow/core/common_runtime/function_testlib.cc:115–132  ·  view source on GitHub ↗

TODO(phawkins): replace with C++ API for calling functions, when that exists.

Source from the content-addressed store, hash-verified

113
114// TODO(phawkins): replace with C++ API for calling functions, when that exists.
115Output Call(Scope* scope, const string& op_name, const string& fn_name,
116 gtl::ArraySlice<Input> inputs) {
117 NodeDef def;
118 NodeDefBuilder builder(op_name, fn_name, scope->graph()->op_registry());
119 for (const Input& input : inputs) {
120 builder.Input(input.node()->name(), input.index(),
121 input.node()->output_type(input.index()));
122 }
123 TF_CHECK_OK(builder.Finalize(&def));
124 Status status;
125 Node* n = scope->graph()->AddNode(def, &status);
126 TF_CHECK_OK(status);
127 TF_CHECK_OK(scope->DoShapeInference(n));
128 for (int i = 0; i < inputs.size(); ++i) {
129 scope->graph()->AddEdge(inputs[i].node(), inputs[i].index(), n, i);
130 }
131 return Output(n);
132}
133
134} // namespace function
135} // namespace test

Callers 3

TEST_FFunction · 0.70
TEST_FFunction · 0.70

Calls 13

DoShapeInferenceMethod · 0.80
nameMethod · 0.65
OutputClass · 0.50
op_registryMethod · 0.45
graphMethod · 0.45
InputMethod · 0.45
nodeMethod · 0.45
indexMethod · 0.45
output_typeMethod · 0.45
FinalizeMethod · 0.45
AddNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected