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

Method Finalize

tensorflow/core/graph/node_builder.cc:115–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115Status NodeBuilder::Finalize(Graph* graph, Node** created_node, bool consume) {
116 // In case of error, set *created_node to nullptr.
117 if (created_node != nullptr) *created_node = nullptr;
118 if (!errors_.empty()) {
119 return errors::InvalidArgument(absl::StrJoin(errors_, "\n"));
120 }
121
122 NodeDef node_def;
123 TF_RETURN_IF_ERROR(def_builder_.Finalize(&node_def, consume));
124 TF_RETURN_IF_ERROR(ValidateNodeDef(node_def, def_builder_.op_def()));
125 TF_RETURN_IF_ERROR(
126 CheckOpDeprecation(def_builder_.op_def(), graph->versions().producer()));
127 Status status;
128 Node* node = graph->AddNode(std::move(node_def), &status);
129 if (!status.ok()) return status;
130
131 node->set_assigned_device_name(assigned_device_);
132
133 for (size_t i = 0; i < inputs_.size(); ++i) {
134 if (inputs_[i].node != nullptr) { // Skip back edges.
135 graph->AddEdge(inputs_[i].node, inputs_[i].index, node, i);
136 }
137 }
138 for (Node* control_input : control_inputs_) {
139 graph->AddControlEdge(control_input, node);
140 }
141 if (created_node != nullptr) *created_node = node;
142 return Status::OK();
143}
144
145void NodeBuilder::AddIndexError(const Node* node, int i) {
146 if (node == nullptr) {

Callers 15

TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 12

InvalidArgumentFunction · 0.85
ValidateNodeDefFunction · 0.85
CheckOpDeprecationFunction · 0.85
emptyMethod · 0.45
op_defMethod · 0.45
versionsMethod · 0.45
AddNodeMethod · 0.45
okMethod · 0.45
sizeMethod · 0.45
AddEdgeMethod · 0.45
AddControlEdgeMethod · 0.45

Tested by 15

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36