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

Function TF_GraphCopyFunction

tensorflow/c/c_api_function.cc:672–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672void TF_GraphCopyFunction(TF_Graph* g, const TF_Function* func,
673 const TF_Function* grad, TF_Status* status) {
674 if (func == nullptr) {
675 status->status = InvalidArgument(
676 "'func' argument to TF_GraphCopyFunction cannot be null");
677 return;
678 }
679
680 // TODO(iga): Add AddFunctionDef() and AddGradientDef() methods to graph
681 // to avoid the extra copy here.
682 tensorflow::FunctionDefLibrary fdef_lib;
683 *fdef_lib.add_function() = func->fdef;
684 if (grad) {
685 *fdef_lib.add_function() = grad->fdef;
686 tensorflow::GradientDef* gdef = fdef_lib.add_gradient();
687 gdef->set_function_name(func->fdef.signature().name());
688 gdef->set_gradient_func(grad->fdef.signature().name());
689 }
690
691 tensorflow::mutex_lock l(g->mu);
692 status->status = g->graph.AddFunctionLibrary(fdef_lib);
693}
694
695int TF_GraphNumFunctions(TF_Graph* g) {
696 tensorflow::mutex_lock l(g->mu);

Callers 2

DefineTMethod · 0.85
TEST_FFunction · 0.85

Calls 5

InvalidArgumentFunction · 0.85
signatureMethod · 0.80
nameMethod · 0.65
add_functionMethod · 0.45
AddFunctionLibraryMethod · 0.45

Tested by 2

DefineTMethod · 0.68
TEST_FFunction · 0.68