Merge pull request #24334 from fengyuentau:fix_24319

dnn onnx: fix not-found constant indices for Gather if shared
pull/24338/head^2
Alexander Smorkalov 1 year ago committed by GitHub
commit b8d4ac589d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/dnn/src/onnx/onnx_importer.cpp
  2. 4
      modules/dnn/test/test_onnx_importer.cpp

@ -2503,11 +2503,11 @@ void ONNXImporter::parseGather(LayerParams& layerParams, const opencv_onnx::Node
CV_CheckEQ(node_proto.input_size(), 2, "");
// TODO: get rid of the type conversions and 1-d/0-d special-casing when the time comes
if (layer_id.find(node_proto.input(1)) == layer_id.end())
if (constBlobs.find(node_proto.input(1)) != constBlobs.end())
{
int real_ndims = getBlobExtraInfo(node_proto.input(1)).real_ndims;
layerParams.set("real_ndims", real_ndims);
if (layer_id.find(node_proto.input(0)) == layer_id.end())
if (constBlobs.find(node_proto.input(0)) != constBlobs.end())
{
std::vector<Mat> inputs, output;

@ -243,6 +243,10 @@ TEST_P(Test_ONNX_layers, GatherMulti)
testONNXModels("gather_multi", npy, 0, 0, false, false);
}
TEST_P(Test_ONNX_layers, Gather_shared_indices) {
testONNXModels("gather_shared_indices", npy, 0, 0, false, false, 1);
}
TEST_P(Test_ONNX_layers, Convolution3D)
{
if (backend == DNN_BACKEND_CUDA && target == DNN_TARGET_CUDA_FP16)

Loading…
Cancel
Save