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

Method AllocateNode

tensorflow/core/graph/graph.cc:776–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776Node* Graph::AllocateNode(std::shared_ptr<NodeProperties> props,
777 const Node* cost_node) {
778 Node* node = nullptr;
779 if (free_nodes_.empty()) {
780 node = new (arena_.Alloc(sizeof(Node))) Node; // placement new
781 } else {
782 node = free_nodes_.back();
783 free_nodes_.pop_back();
784 }
785 node->graph_ = this;
786 const int id = nodes_.size();
787 int cost_id = cost_node ? cost_node->cost_id() : id;
788 node->Initialize(id, cost_id, std::move(props));
789 nodes_.push_back(node);
790 ++num_nodes_;
791 return node;
792}
793
794void Graph::ReleaseNode(Node* node) {
795 TF_DCHECK_OK(IsValidNode(node)) << node->DebugString();

Callers

nothing calls this directly

Calls 8

pop_backMethod · 0.80
cost_idMethod · 0.80
emptyMethod · 0.45
AllocMethod · 0.45
backMethod · 0.45
sizeMethod · 0.45
InitializeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected