Merge pull request #19449 from SamFC10:tf-leakyrelu

* add LeakyRelu to tf-importer

* fix whitespace error

* added test for leakyrelu
pull/19465/head^2
Jebastin Nadar 4 years ago committed by GitHub
parent 863ecded30
commit 09d2ca17cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      modules/dnn/src/tensorflow/tf_importer.cpp
  2. 1
      modules/dnn/test/test_tf_importer.cpp

@ -2414,6 +2414,16 @@ void TFImporter::parseNode(const tensorflow::NodeDef& layer_)
connect(layer_id, dstNet, parsePin(layer.input(0)), id, 0);
}
else if (type == "LeakyRelu")
{
CV_CheckGT(num_inputs, 0, "");
CV_Assert(hasLayerAttr(layer, "alpha"));
layerParams.set("negative_slope", getLayerAttr(layer, "alpha").f());
int id = dstNet.addLayer(name, "ReLU", layerParams);
layer_id[name] = id;
connectToAllBlobs(layer_id, dstNet, parsePin(layer.input(0)), id, num_inputs);
}
else if (type == "Abs" || type == "Tanh" || type == "Sigmoid" ||
type == "Relu" || type == "Elu" ||
type == "Identity" || type == "Relu6")

@ -463,6 +463,7 @@ TEST_P(Test_TensorFlow_layers, leaky_relu)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_OPENCL)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
runTensorFlowNet("leaky_relu");
runTensorFlowNet("leaky_relu_order1");
runTensorFlowNet("leaky_relu_order2");
runTensorFlowNet("leaky_relu_order3");

Loading…
Cancel
Save