allow null constant_value in Pad and ignore it when loading

pull/23491/head
fengyuentau 2 years ago
parent 88cacd35c5
commit 4f99e5ab37
  1. 3
      modules/dnn/src/onnx/onnx_importer.cpp

@ -2605,7 +2605,8 @@ void ONNXImporter::parsePad(LayerParams& layerParams, const opencv_onnx::NodePro
paddings = paddings.t();
layerParams.set("paddings", DictValue::arrayInt(paddings.ptr<int>(), paddings.total()));
if (node_proto.input_size() == 3)
// check for non-null constant_value
if (node_proto.input_size() == 3 && !node_proto.input(2).empty())
{
Mat value = getBlob(node_proto, 2);
float padValue = (depth == CV_8S) ? (float)value.ptr<int8_t>()[0] : value.ptr<float>()[0];

Loading…
Cancel
Save