-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add batch
and ptr
vectors for a list of tensors and nested dicts
#4837
Conversation
…implementation of _collate. Added test in test_batch.py.
Updated CHANGELOG.md. Still missing pull link.
Codecov Report
@@ Coverage Diff @@
## master #4837 +/- ##
==========================================
- Coverage 84.52% 82.79% -1.74%
==========================================
Files 329 329
Lines 17827 17732 -95
==========================================
- Hits 15069 14681 -388
- Misses 2758 3051 +293
Continue to review full report at Codecov.
|
…of tensors. Modified seperate such that InMemoryDataset can deal with lists of tensors correctly. Added test for it.
Modified Fixed |
batch
and ptr
vector for lists of tensors and nested dicts
.
batch
and ptr
vector for lists of tensors and nested dicts
.batch
and ptr
vectors for a list of tensors and nested dicts
.
batch
and ptr
vectors for a list of tensors and nested dicts
.batch
and ptr
vectors for a list of tensors and nested dicts.
batch
and ptr
vectors for a list of tensors and nested dicts.batch
and ptr
vectors for a list of tensors and nested dicts.
batch
and ptr
vectors for a list of tensors and nested dicts.batch
and ptr
vectors for a list of tensors and nested dicts.
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! This looks pretty clean. If possible, I would like to move computation of batch
and ptr
into a single function though.
Please also add the change to the |
Fix elif bug, change _batch name, clean-up (by rust1s) Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Just as a heads up: I haven't done a full test. |
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.
@jan-meissner This looks super good to me. Let me know once this is ready to merge :)
@rusty1s Thanks! I'm done with it so it should be ready for merge. |
Removed old/wrong code comment.
batch
and ptr
vectors for a list of tensors and nested dicts.batch
and ptr
vectors for a list of tensors and nested dicts
Feature:
Adds batching for a list of tensors and nested dicts. Motivation comes from higher order GNNs such as Simplicial Neural Networks or CW complexes, where one often needs to batch over an unknown amount of tensors. Also added support for calculating the batch vector for nested dicts.
Example:
Batching over a dataset with data objects of the form
Data(xs=[tensor1, tensor2, tensor3])
and usingfollow_batch = ['xs']
in the loader now yieldsDataBatch(xs = [3], xs_batch = [3], xs_ptr = [3])
wherexs_batch
is the list of batches[tensor1_batch, tensor2_batch, tensor3_batch]
. Analogous forptr
.Additional Issue fixed:
Resolved a issue concerning
separate
(and thereforeInMemoryDataset
) when batching over lists of tensors. EssentiallyInMemoryDataset
fails to recover thedata_list
correctly. Here is a code snippet to reproduce the issue: