MCPcopy Create free account
hub / github.com/OAID/Tengine / AddConstNodeToSubGraph

Function AddConstNodeToSubGraph

executor/lib/graph_optimizer.cpp:201–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201static void AddConstNodeToSubGraph(Subgraph* graph, Tensor* tensor, Node* fused_node, int fused_port_index)
202{
203 Tensor* new_tensor = new Tensor(*tensor);
204
205 std::string new_tensor_name = new_tensor->GetName();
206
207 // if(new_tensor_name.rfind(".fused")==std::string::npos)
208 new_tensor_name += ".fused";
209
210 new_tensor->SetName(new_tensor_name);
211
212 Node* new_node = new Node(new_tensor->GetName());
213 Operator* op = new_node->GetOp();
214
215 op = OpManager::CreateOp("Const");
216 new_node->SetOp(op);
217 new_node->AddOutputTensor(new_tensor);
218 new_tensor->producer = new_node->GetOutputPort(0);
219 fused_node->AddInputTensor(new_tensor);
220 new_tensor->consumer.clear();
221 new_tensor->consumer.push_back(fused_node->GetInputPort(fused_port_index));
222 graph->seq_nodes.push_back(new_node);
223 graph->SetNodeOwner(new_node);
224 graph->SetTensorOwner(new_tensor);
225
226 if(tensor->ExistAttr("free_mem"))
227 tensor->RemoveAttr("free_mem");
228
229 // return new_tensor;
230}
231
232static bool GraphFuseBNScale(Graph* graph, GraphOptimizer* opt)
233{

Callers 4

Weight_BnFunction · 0.85
GraphFuseBNScaleFunction · 0.85
GraphFuseConvBNFunction · 0.85
GraphFuseConvReLuCommonFunction · 0.85

Calls 13

GetNameMethod · 0.80
GetOpMethod · 0.80
SetOpMethod · 0.80
AddOutputTensorMethod · 0.80
GetOutputPortMethod · 0.80
AddInputTensorMethod · 0.80
clearMethod · 0.80
GetInputPortMethod · 0.80
SetNodeOwnerMethod · 0.80
SetTensorOwnerMethod · 0.80
RemoveAttrMethod · 0.80
SetNameMethod · 0.45

Tested by

no test coverage detected