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

Function LoadSoftmax

tengine-module/plugin/serializer/tensorflow/tf_serializer.cpp:2517–2543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2515}
2516
2517static bool LoadSoftmax(TFNode* tf_node, TFGraph& tf_graph, StaticGraph* graph)
2518{
2519 TFNode* input = tf_node->inputs[0];
2520 StaticNode* node = tf_node->static_node;
2521 AddNodeInputTensor(node, input->static_tensor);
2522
2523 SoftmaxParam param = any_cast<SoftmaxParam>(OpManager::GetOpDefParam("Softmax"));
2524 /* it seems tensorflow justs support last dimension */
2525 const tensorflow::NodeDef* node_def = tf_node->pb_defs[0];
2526 tensorflow::AttrValue value;
2527 if(GetAttrValue(node_def, "value", value))
2528 {
2529 const tensorflow::TensorProto& tf_tensor = value.tensor();
2530 int axis = tf_tensor.int_val(0);
2531 param.axis = axis;
2532 }
2533 else
2534 param.axis = 3;
2535
2536 StaticOp* op = CreateStaticOp(graph, "Softmax");
2537 SetOperatorParam(op, param);
2538 SetNodeOp(node, op);
2539
2540 AddGraphOutputNode(graph, node);
2541
2542 return true;
2543}
2544
2545static bool LoadRelu(TFNode* tf_node, TFGraph& tf_graph, StaticGraph* graph)
2546{

Callers

nothing calls this directly

Calls 6

AddNodeInputTensorFunction · 0.85
GetAttrValueFunction · 0.85
CreateStaticOpFunction · 0.85
SetOperatorParamFunction · 0.85
SetNodeOpFunction · 0.85
AddGraphOutputNodeFunction · 0.85

Tested by

no test coverage detected