Slice layer parser fix to support empty input case#25660
Slice layer parser fix to support empty input case#25660asmorkalov merged 2 commits intoopencv:4.xfrom
Conversation
| { | ||
| MatShape inpShape = outShapes[node_proto.input(0)]; | ||
| MatShape inpShape; | ||
| if (constBlobs.find(node_proto.input(0)) != constBlobs.end() && outShapes[node_proto.input(0)].empty()) |
There was a problem hiding this comment.
Why we need to check for empty shapes if the question is to handle constant or variable input?
There was a problem hiding this comment.
The idea is to catch cases when there is no input (which is effectively an empty shape) and check whether an input is found in the constants. Probably, I should add on more branches that ACCERTS that at least one of these conditions is true.
There was a problem hiding this comment.
I used to think that constBlobs.find(node_proto.input(0)) != constBlobs.end() is enough to catch constant input.
There was a problem hiding this comment.
I used to think that
constBlobs.find(node_proto.input(0)) != constBlobs.end()is enough to catch constant input.
In reality, this that enough. I just added it to make sure that we catch exactly the case I am talking about since I was not sure if constBlobs get filled on when there is one input.
If this is crucial I can remove the other part of condition
There was a problem hiding this comment.
Yes, let's remove please until we find a proper reproducer
This PR fixes Slice Layer's parser to handle empty input cases (cases with initializer)
It fixed the issue rased in #24838
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.