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

Method CopyNode

tensorflow/core/graph/graph.cc:452–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452Node* Graph::CopyNode(const Node* node) {
453 DCHECK(!node->IsSource());
454 DCHECK(!node->IsSink());
455 Node* copy = AllocateNode(node->props_, node);
456 copy->set_assigned_device_name(node->assigned_device_name());
457
458 // Since the OpDef of a function may be owned by the Graph that owns 'node',
459 // relookup the OpDef in the target graph. If it differs, then clone the
460 // node properties with the updated OpDef.
461 const OpDef* op_def;
462 TF_CHECK_OK(ops_.LookUpOpDef(node->type_string(), &op_def));
463 if (op_def != node->props_->op_def) {
464 copy->MaybeCopyOnWrite();
465 copy->props_->op_def = op_def;
466 }
467
468 return copy;
469}
470
471void Graph::RemoveNode(Node* node) {
472 TF_DCHECK_OK(IsValidNode(node)) << node->DebugString();

Callers 15

CopySubgraphFunction · 0.80
FunctionalizeLoopFunction · 0.80
ExtractBodiesMethod · 0.80
MakeNodeImageMethod · 0.80
MakeNodeImageMethod · 0.80
ExtractConstantSubgraphFunction · 0.80
AddNodeToConstantGraphFunction · 0.80

Calls 5

IsSourceMethod · 0.80
IsSinkMethod · 0.80
LookUpOpDefMethod · 0.80
MaybeCopyOnWriteMethod · 0.80

Tested by 1

TEST_FFunction · 0.64