{ "Constant", &OnnxParser::ParseConstant },
{ "MaxPool", &OnnxParser::ParseMaxPool },
{ "Reshape", &OnnxParser::ParseReshape },
+ { "Sigmoid", &OnnxParser::ParseSigmoid },
+ { "Tanh", &OnnxParser::ParseTanh },
{ "Relu", &OnnxParser::ParseRelu },
+ { "LeakyRelu", &OnnxParser::ParseLeakyRelu },
{ "Conv", &OnnxParser::ParseConv },
{ "Add", &OnnxParser::ParseAdd },
};
}
}
-void OnnxParser::ParseRelu(const onnx::NodeProto& node)
+void OnnxParser::ParseActivation(const onnx::NodeProto& node, const armnn::ActivationFunction func)
{
CHECK_VALID_SIZE(static_cast<size_t>(node.input_size()), 1);
CHECK_VALID_SIZE(static_cast<size_t>(node.output_size()), 1);
VALID_INPUTS(node, STR_LIST(onnx::TensorProto::FLOAT));
ActivationDescriptor desc;
- desc.m_Function = ActivationFunction::ReLu;
+ desc.m_Function = func;
IConnectableLayer* const layer = m_Network->AddActivationLayer(desc, node.name().c_str());
BOOST_ASSERT(layer != nullptr);
RegisterOutputSlots(layer, {node.output(0)});
}
+void OnnxParser::ParseSigmoid(const onnx::NodeProto& node)
+{
+ ParseActivation(node, ActivationFunction::Sigmoid);
+}
+
+void OnnxParser::ParseTanh(const onnx::NodeProto& node)
+{
+ ParseActivation(node, ActivationFunction::TanH);
+}
+
+void OnnxParser::ParseRelu(const onnx::NodeProto& node)
+{
+ ParseActivation(node, ActivationFunction::ReLu);
+}
+
+void OnnxParser::ParseLeakyRelu(const onnx::NodeProto& node)
+{
+ ParseActivation(node, ActivationFunction::LeakyReLu);
+}
void OnnxParser::AddConvLayerWithDepthwiseConv(const onnx::NodeProto& node, const Convolution2dDescriptor& convDesc)
{
namespace armnn
{
class TensorInfo;
+enum class ActivationFunction;
}
namespace armnnOnnxParser
void AddPoolingLayer(const onnx::NodeProto& nodeProto, armnn::Pooling2dDescriptor& desc);
void ParseReshape(const onnx::NodeProto& nodeProto);
+
+ void ParseActivation(const onnx::NodeProto& nodeProto, const armnn::ActivationFunction func);
+ void ParseSigmoid(const onnx::NodeProto& nodeProto);
+ void ParseTanh(const onnx::NodeProto& nodeProto);
void ParseRelu(const onnx::NodeProto& nodeProto);
+ void ParseLeakyRelu(const onnx::NodeProto& nodeProto);
void AddConvLayerWithDepthwiseConv(const onnx::NodeProto& node, const armnn::Convolution2dDescriptor& convDesc);
void ParseConv(const onnx::NodeProto& nodeProto);