-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Slice layer parser fix to support empty input case #25660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slice layer parser fix to support empty input case #25660
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.