FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: fix deepcopy torchtensor by JoanFM · Pull Request #1720 · docarray/docarray · GitHub

fix: fix deepcopy torchtensor - #1720

Merged
JoanFM merged 1 commit into
mainfrom
fix-torch-tensor-deepcopy
Jul 21, 2023
Merged

fix: fix deepcopy torchtensor#1720
JoanFM merged 1 commit into
mainfrom
fix-torch-tensor-deepcopy

Conversation

JoanFM commented Jul 21, 2023

Copy link
Copy Markdown
Member

No description provided.

codecov Bot commented Jul 21, 2023
edited
Loading

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.72 🎉

Comparison is base (007f113) 84.84% compared to head (7b1384b) 85.56%.

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     
Flag Coverage Δ
docarray 85.56% <100.00%> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/typing/tensor/torch_tensor.py 91.08% <100.00%> (+0.18%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
JoanFM force-pushed the fix-torch-tensor-deepcopy branch from 2d79034 to 7b1384b Compare July 21, 2023 07:32

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-fix-torch-tensor-deepcopy--jina-docs.netlify.app 🎉

"""cast itself to a numpy array"""
return self.detach().cpu().numpy()

def new_empty(self, *args, **kwargs):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

can we copy the full signature of the original method ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if it is always the same, I do not think it makes sense, this is way more mantainable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

But this break everything related to mypy and pycharm feature. In DocArray v2 we always repeat the full signature of the function

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

but mypy check passes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

okay oaky

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

mypy pass because it does not look at it. It will only check if there is type hint

JoanFM requested a review from samsja July 21, 2023 11:48
JoanFM merged commit 304a4e9 into main Jul 21, 2023
JoanFM deleted the fix-torch-tensor-deepcopy branch July 21, 2023 12:17
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TorchTensor cannot be deep copied.

2 participants


Back | FazBrowse Home | New Git URL