Supported ONNX Pow op

pull/18181/head
Liubov Batanina 5 years ago
parent 8c1af09989
commit d392b11dfb
  1. 13
      modules/dnn/src/onnx/onnx_importer.cpp
  2. 5
      modules/dnn/test/test_onnx_importer.cpp

@ -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…
Cancel
Save