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

Method LoadNode

tengine-module/plugin/serializer/caffe/caffe_serializer.cpp:235–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235bool CaffeSingle::LoadNode(StaticGraph* graph, StaticNode* node, const te_caffe::LayerParameter& layer_param,
236 name_map_t& tensor_name_map)
237{
238 for(int i = 0; i < layer_param.bottom_size(); i++)
239 {
240 const std::string& orig_name = layer_param.bottom(i);
241
242 std::string& tensor_name = tensor_name_map[orig_name];
243
244 StaticTensor* tensor = FindTensor(graph, tensor_name);
245
246 AddNodeInputTensor(node, tensor);
247 }
248
249 for(int i = 0; i < layer_param.top_size(); i++)
250 {
251 const std::string& orig_name = layer_param.top(i);
252 std::string tensor_name;
253
254 if(tensor_name_map.count(orig_name))
255 tensor_name = GetNodeName(node) + "/" + std::to_string(i);
256 else
257 tensor_name = orig_name;
258
259 StaticTensor* tensor = CreateStaticTensor(graph, tensor_name);
260
261 SetTensorDataType(tensor, DataType::GetTypeID("float32"));
262
263 AddNodeOutputTensor(node, tensor);
264
265 // record the name mapping
266
267 tensor_name_map[orig_name] = tensor_name;
268 }
269
270 return true;
271}
272
273bool CaffeSingle::LoadGraph(te_caffe::NetParameter& caffe_net, StaticGraph* graph)
274{

Callers

nothing calls this directly

Calls 6

FindTensorFunction · 0.85
AddNodeInputTensorFunction · 0.85
CreateStaticTensorFunction · 0.85
SetTensorDataTypeFunction · 0.85
GetTypeIDFunction · 0.85
AddNodeOutputTensorFunction · 0.85

Tested by

no test coverage detected