fix: tensor equals type raises exception#1739
Merged
Conversation
Signed-off-by: Johannes Messner <messnerjo@gmail.com>
Signed-off-by: Johannes Messner <messnerjo@gmail.com>
Signed-off-by: Johannes Messner <messnerjo@gmail.com>
samsja
approved these changes
Jul 31, 2023
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1739 +/- ##
==========================================
+ Coverage 84.45% 84.46% +0.01%
==========================================
Files 134 134
Lines 8840 8840
==========================================
+ Hits 7466 7467 +1
+ Misses 1374 1373 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
JoanFM
requested changes
Jul 31, 2023
| ) | ||
| return any(issubclass(candidate, cls) for candidate in type(instance).mro()) | ||
| return any( | ||
| issubclass(candidate, cls) for candidate in type(instance).__mro__ |
Member
There was a problem hiding this comment.
us safe version of is_subclass please
Member
Author
There was a problem hiding this comment.
i am not sure if we want that here. This implements the "normal" isinstance() call, so i don't think it should work with non-class inputs. For example, the following also raises an exception:
isinstance(3, List[int])TypeError: Subscripted generics cannot be used with class and instance checks
So I would not catch such things here
Signed-off-by: Johannes Messner <messnerjo@gmail.com>
|
📝 Docs are deployed on https://ft-fix-tensor-equals-type--jina-docs.netlify.app 🎉 |
Closed
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.
Currently the following raises and exception:
This fixes that