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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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])));

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);