Reject a classifier whose probabilities have a symbolic shape - #2793
Open
LeSingh1 wants to merge 1 commit into
Open
Reject a classifier whose probabilities have a symbolic shape#2793LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
The Core ML runtime requires a classifier's probabilities to have a fully known shape. With a flexible input shape the size check in classify's type inference is skipped, so conversion returns a model that fails to compile for every input shape, including the ones where the symbol resolves to a size matching the class labels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
classify's type inference only checks that the number of class labels matches the size ofprobabilitieswhen that shape is fully known. With a flexible input shape the check is skipped, so conversion succeeds and returns a model the Core ML runtime cannot compile:This fails for every input shape, including the ones where the symbol resolves to a size that matches the labels, so there is no shape at which the returned model works. A fixed non-matching batch already raises at conversion time; this makes the flexible case fail there too instead of at prediction.
Repro on
main(converts, then everypredictfails):Added a parametrized test over enumerated and range-dimension shapes; both fail on
main.Refs #2764