-
Notifications
You must be signed in to change notification settings - Fork 60
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
[2/n] MultiEmbeddingTensor
: Add MultiEmbeddingTensor
#181
Conversation
eaec2b3
to
ed5e6e3
Compare
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.
Thanks for starting. I think we can create a base class to share basic logics with MultiNestedTensor
. For MultiEmbeddingTensor
, I think you can first implement MultiEmbeddingTensor.from_tensor_list
and make sure met[i, j]
is working properly. Then, we can gradually build up advanced indexing and concatenation in separate PRs.
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.
Thank you for your work. I think there are some small bugs and edge case handling that need to be resolved in this pr.
Also, I think it might be better to create a base class for this and MultiNestedTensor
.
num_rows = 3 | ||
num_cols = 2 | ||
offset = torch.tensor([0, 2, 4]) | ||
values = torch.tensor([ |
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.
Use rand
to generate tensor.
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 prefer this way to random tensors for readability, but I can replace this if you'd advocate for it
ed5e6e3
to
531c1ed
Compare
Codecov Report
@@ Coverage Diff @@
## master #181 +/- ##
==========================================
+ Coverage 91.86% 92.05% +0.18%
==========================================
Files 105 107 +2
Lines 4376 4480 +104
==========================================
+ Hits 4020 4124 +104
Misses 356 356
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
6c1f2c9
to
aaf88a9
Compare
531c1ed
to
efc5e34
Compare
MultiEmbeddingTensor
MultiEmbeddingTensor
: Add MultiEmbeddingTensor
efc5e34
to
d689867
Compare
aaf88a9
to
9ac1e69
Compare
Rename _to_positive_index _normalize_index [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci unused imports docs update
9ac1e69
to
1576bbe
Compare
bbdf3cd
to
78e6cc6
Compare
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
78e6cc6
to
9255f0e
Compare
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.
@yiweny @rusty1s @weihua916 @zechengz Ready for your second review ;)
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.
LGM, thanks!
|
||
def __getitem__( | ||
self, | ||
index: Any, |
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.
index: Any, | |
index: IndexSelectType, |
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.
Will address in a follow-up!
Adds
MultiEmbeddingTensor
as part of #88.Follow-up tasks:
stype.embedding
andEmbeddingTensorMapper
Refactor this withbeing addressed via [1/n]MultiNestedTensor
MultiEmbeddingTensor
: Restructure and clean upMultiNestedTensor
#183.