1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #20674 from rogday:prelu_slope

Fix PReLU negative slope access pattern

* fix prelu negative slope access pattern

* change begin() to ptr()
This commit is contained in:
rogday
2021-09-10 14:07:16 +03:00
committed by GitHub
parent ac0fd6aa9a
commit d31b93b513
2 changed files with 6 additions and 1 deletions
@@ -1542,7 +1542,7 @@ Ptr<Layer> ChannelsPReLULayer::create(const LayerParams& params)
if (params.blobs[0].total() == 1)
{
LayerParams reluParams = params;
reluParams.set("negative_slope", params.blobs[0].at<float>(0));
reluParams.set("negative_slope", *params.blobs[0].ptr<float>());
return ReLULayer::create(reluParams);
}
Ptr<ChannelsPReLULayer> l(new ElementWiseLayer<ChannelsPReLUFunctor>(ChannelsPReLUFunctor(params.blobs[0])));
+5
View File
@@ -250,6 +250,11 @@ TEST_P(Test_ONNX_layers, ReLU)
testONNXModels("ReLU");
}
TEST_P(Test_ONNX_layers, PReLU)
{
testONNXModels("PReLU_slope");
}
TEST_P(Test_ONNX_layers, Clip)
{
testONNXModels("clip", npy);