mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00
Merge pull request #18181 from l-bat:onnx_pow
This commit is contained in:
commit
f5ba3f51ce
@ -712,6 +712,19 @@ void ONNXImporter::populateNet(Net dstNet)
|
||||
layerParams.set("bias_term", true);
|
||||
}
|
||||
}
|
||||
else if (layer_type == "Pow")
|
||||
{
|
||||
if (layer_id.find(node_proto.input(1)) != layer_id.end())
|
||||
CV_Error(Error::StsNotImplemented, "Unsupported Pow op with variable power");
|
||||
|
||||
Mat blob = getBlob(node_proto, constBlobs, 1);
|
||||
if (blob.total() != 1)
|
||||
CV_Error(Error::StsNotImplemented, "Pow op supports only scalar power");
|
||||
|
||||
blob.convertTo(blob, CV_32F);
|
||||
layerParams.type = "Power";
|
||||
layerParams.set("power", blob.at<float>(0));
|
||||
}
|
||||
else if (layer_type == "Max")
|
||||
{
|
||||
layerParams.type = "Eltwise";
|
||||
|
@ -283,6 +283,11 @@ TEST_P(Test_ONNX_layers, Cast)
|
||||
testONNXModels("cast");
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, Power)
|
||||
{
|
||||
testONNXModels("pow2", npy, 0, 0, false, false);
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, Concatenation)
|
||||
{
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
|
||||
|
Loading…
Reference in New Issue
Block a user