-
Notifications
You must be signed in to change notification settings - Fork 233
fix: fix deepcopy torchtensor #1720
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
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1720 +/- ##
==========================================
+ Coverage 84.84% 85.56% +0.72%
==========================================
Files 133 133
Lines 8583 8585 +2
==========================================
+ Hits 7282 7346 +64
+ Misses 1301 1239 -62
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Signed-off-by: Joan Fontanals Martinez <[email protected]>
2d79034
to
7b1384b
Compare
📝 Docs are deployed on https://ft-fix-torch-tensor-deepcopy--jina-docs.netlify.app 🎉 |
@@ -271,3 +271,10 @@ def _docarray_from_ndarray(cls: Type[T], value: np.ndarray) -> T: | |||
def _docarray_to_ndarray(self) -> np.ndarray: | |||
"""cast itself to a numpy array""" | |||
return self.detach().cpu().numpy() | |||
|
|||
def new_empty(self, *args, **kwargs): |
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.
can we copy the full signature of the original method ?
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.
if it is always the same, I do not think it makes sense, this is way more mantainable
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.
But this break everything related to mypy and pycharm feature. In DocArray v2 we always repeat the full signature of the function
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.
but mypy check passes
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 method on TorchEmbedding does the same.
This is a method that noone should use
It is easier to forget to update this method than anything else.
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.
okay oaky
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.
mypy pass because it does not look at it. It will only check if there is type hint
No description provided.